I'm working on an Windows Forms application. And entity is retrieved from database, passed to UI to let user edit and the save it back to database.
I'm having a problem with the name unique constraint. It's like a file system when there should not be two file with the same name in the same folder. The constraint is enforced at database level. According to my understanding, when I try to save the entity, if the name is not unique, an exception will be thrown, and I'll have to throw away the session as well as the object. My question is since I have only one instance of the object, and the UI is bound to the instance of entity, how should I handle this? I did try adding manual code to clone the entity and save the clone with another session so that if there's an exception, I still have my original entity. The problem with this approach is the UI is bound to the main entity instance, is there anyway that I can tell NHibernate to populate saved data (ID and timestamps) to the main entity instance? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhusers@googlegroups.com To unsubscribe from this group, send email to nhusers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---