emmanuel wrote:
There was a post some times ago on that subject, but I can't remember which one.
Yes, it was here:
http://forum.hibernate.org/viewtopic.ph ... texception
But no answer was ultimately given; the dialog digressed into the semantics of composite primary keys (and database behavior when one was null) amongst different databases.
Someone made the comment that, "SQLServer thinks that if one of the fk column is null the fk is null. Don' know how other db handle that but my dba told me that this is the most common case."
His DBA is wrong - both MySQL and Oracle, arguably the two most popular databases, both allow null in one or more of the components of a composite primary key if at least one of the components is not-null.
I suspect that handling the exception is all that can be done.