|
[
Permalink
| « Hide
]
Gavin King added a comment - 08/Jun/04 07:44 PM
This is not a bug. This is as per Hibernate doco. "discard the session and all persistent objects".
I feel that declaring this not a bug is a cop-out. There's no dispute about the documents - but there is dispute about the design here!
I know that Hibernate cannot possibly unroll all the changes but in many cases it doesn't need to since the application should be aware of these and able to roll them back. The one thing the application can't roll-back is any auto-generated ID assignments. Therefore it is appropriate that Hibernate remove these on failure. Doing so would make it much easier to cope with situations like this (which are required in my situation too for very good reason). I strongly urge you to re-consider adding this functionality. I agree with Tom on this issue.
Since Hibernate modifies my objects, adding the identity values during the save(), after a rollback I expect Hibernate to be responsible for rolling back its changes to my in memory objects. This has been added to Hibernate3 a while ago, you are welcome to backport it if you need it in Hibernate 2.x.
I assume by 'added' you're referring to the hibernate.use_identifer_rollback property (http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html)?
It didn't appear to work for me, but that might be unrelated. |
|||||||||||||||||||||||||||||||||||||||||||||||