If I do the following
session.getTransaction().rollback();
is it then ok/possible to start calling save/update/delete etc. on the same session object? Couldnt find the answer to this in the Hibernate Session/Transaction API, or in the Hibernate reference documentation.
Or do you recommend me to close that Session object, open a new Session and begin a new Transaction?
-
I'm not sure if this is possible/adviceable from a database point of view, but writing atomic code is so much better for readibility. You may even reuse the structure of a template method to forget about the wirings around your transaction.
-
I say close the session and open a new one. Hibernate is not known for being forgiving about abuse of its sessions. It may hurt performance a bit, but it will probably prevent a bug down the road.
Yuval =8-)
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.