Hi all, Im new using nhibernate and I dont understand when an object pass from persistence to transient.
When I delete a persistence object with ISession.Delete method nHibernate dont reset de idenfier value to unsaved-value indicated in my mappings files in order to make de object transient.
I have a test that create a new Object, save it, and then delete it. In that moment de object is transient, but it has de id value of the row that just had been delete from database.
If try to save de object again with saveupdate method, hibernate try to do and Update because de object not have de unsaved-value as identifier and exception is thrown because de row was deleted.
My set method for de id is private and I dont want to set de id to unsaved value myself.
Actually the test expected de exception and works well, but i wonder is ther any way of avoid the exception.
Thanks
|