Hi,
I'm currently developping an EJB (CMT) which uses hibernate for persistence. This ejb contains state-modifying methods (update, save) and finder / query methods which do not alter the system state.
For update methods, the transaction attribute to use would be something like REQUIRED or REQUIRES_NEW but what about finder methods? As long as those do not change anything, I thought I could use NOT_SUPPORTED... but if I do this, Hibernate won't be able to bind the session to the current transaction (because there's no transaction) and I won't be able to use SessionFactory.getCurrentSession().
So depending on which operation I would like to do (update or find), I would handle sessions differently (SessionFactory.getCurrentSession() in the first case, try / catch block with SessionFactory.openSession() and Session.close() in the second case).
I would like to know if other people encountered this problem.
thanks a lot,
Xavier
|