Author: dan.j.allen
Date: 2008-09-21 23:02:30 -0400 (Sun, 21 Sep 2008)
New Revision: 9081
Modified:
trunk/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java
trunk/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
Log:
JBSEAM-3440
Modified: trunk/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java 2008-09-22
02:37:37 UTC (rev 9080)
+++ trunk/src/main/org/jboss/seam/persistence/ManagedHibernateSession.java 2008-09-22
03:02:30 UTC (rev 9081)
@@ -150,7 +150,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;
@@ -218,7 +218,7 @@
{
log.debug("destroying seam managed session for session factory: " +
sessionFactoryJndiName);
}
- if (session!=null)
+ if (session!=null && session.isOpen())
{
session.close();
}
Modified: trunk/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java 2008-09-22
02:37:37 UTC (rev 9080)
+++ trunk/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java 2008-09-22
03:02:30 UTC (rev 9081)
@@ -206,7 +206,7 @@
log.debug("destroying seam managed persistence context for persistence
unit: " + persistenceUnitJndiName);
}
- if (entityManager!=null)
+ if (entityManager!=null && entityManager.isOpen())
{
entityManager.close();
}
Show replies by date