From: Brad C. <bra...@wo...> - 2002-02-27 07:16:48
|
The procedure for writing session beans (using hibernate) that participate in EJB transactions is not immediately apparent from the documentation. Perhaps a note could be added to the documentation that specifies that for this situation, the successful way to create a transaction aware hibernate session is via: sessionFactory = datastore.buildSessionFactory(); session = sessionFactory.openSession(connection); The system properties mechanism and passing Properties to the buildSessionFactory will not work. This is due to the fact that the session.commit() (and cancel) methods behave differenently, depending on how the session was obtained. If the session was obtained using one of the properties mechanisms, than hibernate will flush the session, commit and close the connection, which breaks the EJB transaction. If the session is obtained by passing in a connection, then it is up to the user (or the EJB container, in this case) to commit the connection and the programmer to close the connection. brad _______________________________ brad clow chief technical officer workingmouse email: bra...@wo... web: http://www.workingmouse.com |