In Hibernate 2.0 you cannot take advantage of "contextual sessions" on a managed environment, so your options for ensuring that every DB operation is wrapped in a transaction are:
-writing wrapping transaction code manually each time
-creating a base Data Access class, which all your DAO classes will extend, and which has basic insert(bean) delete(id) update(bean) executeSelect(SQL) methods, and inside each of those methods one session is obtained with Threadlocal and a transaction is created/begun/commited/trycached.
_________________ Gonzalo Díaz
|