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();
}