Thanks for the pointer. Maybe I should have mentioned that the composite key needs to be unique.
My understanding was that unsaved-value="any" will always do an insert when SaveOrUpdate() is called. I believe the default value for unsaved- value is "none" which will mean it always does an update. As mentioned with current code & SaveOrUpdate it always does an update. So that matches with unsaved-value="none". If I change the composite-id to have the attribute unsaved-value="any" then it always does an update - even when the record exists in the database and update should have been done. This means I blow the constraint that the composite key is unique. My code works as it is fine; by just checking for existence of the record and then doing Update or Save as required. It just feels like I'm missing something here that stops me from using the simpler SaveOrUpdate(). On the other hand I've read the docs & understand that the composite key means NH can't get a unique handle on the instance, so maybe this is the only way & I should treat SaveOrUpdate as a "special" to use only on tables with a normal primary key. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
