Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I'm using detached objects and I just noticed that an object that is saved in the scope of a transaction, and thus gets its identifier, will not lose it if the transaction is rolled back. That means that, depending of the way you do it, in the worst case you have to keep aware of all new identifiers that have been assigned to any new objects who may be referenced from outside the transaction, and then set them all to zero (or whatever) on rollback.
Now if you come to think of it, this happens not only with the identifiers, but with any property that, according to business rules, gets changed in what ultimately comes to be a rolled back transaction.
So either you have a very clean Business Facade and you just pass it copies of the objects you have on your hands, or you risk having their state corrupted.
Is is just present panic or does this blur the whole transaction scope thing, and the more object-oriented and abstracted from the persistence medium you are, then the more subject to all sorts of side-effects you'll also be?
Help a lost soul.
Thanks,
Luis