Unique Constraint Nhibernate.
- by Will
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?