The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Kai Schmidt (1) [Avatar] Offline
In chapter 9.1.2 there is an example for a database constraint spanning over multiple tables:

alter table BID
add constraint AUCTION_BID_TIME
check(CREATEDON <= (select i.AUCTIONEND from ITEM i where i.ID = ITEM_ID));

As I found out now mySQL doesn't support check constraints at all. PostgreSQL and SQL Server doesn't support selects within a check constraints. Also as far as I know from Oracle database check constraints are only row based. The "manual" workaround for mySQL and PostgreSQL seems to be the use of triggers instead. However, I can't imagine that Hibernate translate such check constraint into a database trigger.

What does Hibernate do with such a statement and with which DBMS is this working?

P.S.: Thanks a lot for your great book. Although I'm using Hibernate for several years now, I learned a lot and the book it's structured very well. It's a really good reference.