[seam-commits] Seam SVN: r9082 - branches/community/Seam_2_0/src/main/org/jboss/seam/persistence.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sun Sep 21 23:03:30 EDT 2008


Author: dan.j.allen
Date: 2008-09-21 23:03:30 -0400 (Sun, 21 Sep 2008)
New Revision: 9082

Modified:
   branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java
   branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
Log:
JBSEAM-3440


Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java	2008-09-22 03:02:30 UTC (rev 9081)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java	2008-09-22 03:03:30 UTC (rev 9082)
@@ -144,7 +144,7 @@
       {
          throw new IllegalStateException("cannot passivate persistence context with active transaction");
       }
-      if ( session!=null && !session.isDirty() )
+      if ( session!=null && session.isOpen() && !session.isDirty() )
       {
          session.close();
          session = null;
@@ -212,7 +212,7 @@
       {
          log.debug("destroying seam managed session for session factory: " + sessionFactoryJndiName);
       }
-      if (session!=null)
+      if (session!=null && session.isOpen())
       {
          session.close();
       }

Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java	2008-09-22 03:02:30 UTC (rev 9081)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java	2008-09-22 03:03:30 UTC (rev 9082)
@@ -205,7 +205,7 @@
          log.debug("destroying seam managed persistence context for persistence unit: " + persistenceUnitJndiName);
       }
       
-      if (entityManager!=null)
+      if (entityManager!=null && entityManager.isOpen())
       {
          entityManager.close();
       }




More information about the seam-commits mailing list