From: Bill B. <pat...@us...> - 2004-06-25 16:49:02
|
User: patriot1burke Date: 04/06/25 09:48:56 Modified: src/main/org/jboss/ejb3 HibernateSessionFactory.java Log: close hibernate session in beforeCompletion Revision Changes Path 1.2 +8 -6 jboss-ejb3/src/main/org/jboss/ejb3/HibernateSessionFactory.java Index: HibernateSessionFactory.java =================================================================== RCS file: /cvsroot/jboss/jboss-ejb3/src/main/org/jboss/ejb3/HibernateSessionFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HibernateSessionFactory.java 25 Jun 2004 03:58:42 -0000 1.1 +++ HibernateSessionFactory.java 25 Jun 2004 16:48:55 -0000 1.2 @@ -45,7 +45,7 @@ /** * @author <a href="mailto:ga...@hi...">Gavin King</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class HibernateSessionFactory { @@ -76,24 +76,26 @@ public void beforeCompletion() { - int status = 0; try { - status = tx.getStatus(); + int status = tx.getStatus(); + if (status != Status.STATUS_ROLLEDBACK && status != Status.STATUS_ROLLING_BACK && status != Status.STATUS_MARKED_ROLLBACK) + { + session.flush(); + } } catch (SystemException e) { throw new RuntimeException(e); } - if (status != Status.STATUS_ROLLEDBACK && status != Status.STATUS_ROLLING_BACK && status != Status.STATUS_MARKED_ROLLBACK) + finally { - session.flush(); + session.close(); } } public void afterCompletion(int status) { - session.close(); } } |