Unique Constraint Nhibernate.
Posted
by Will
on Stack Overflow
See other posts from Stack Overflow
or by Will
Published on 2010-03-17T15:57:56Z
Indexed on
2010/03/17
19:51 UTC
Read the original article
Hit count: 413
I have a object with a Nhibernate mapping that has a surrogate ID and a natual ID. Since of cource the natural ID is uniquely constrained a insert query will fail if the object is already in the database with the same natural ID. My solution for this has been to manually check to see if natural IDs are in the database before trying to insert.
Is there a way to specify Nhibernate to do a select before insert on natural Id's/Unique Constraints?
© Stack Overflow or respective owner