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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Jun 11 16:27:39 EDT 2008


Author: norman.richards at jboss.com
Date: 2008-06-11 16:27:39 -0400 (Wed, 11 Jun 2008)
New Revision: 8371

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

Modified: branches/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java	2008-06-11 13:05:05 UTC (rev 8370)
+++ branches/Seam_2_0/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java	2008-06-11 20:27:39 UTC (rev 8371)
@@ -134,34 +134,18 @@
    }
    
    //we can't use @PrePassivate because it is intercept NEVER
-   public void sessionWillPassivate(HttpSessionEvent event)
-   {
-      if (synchronizationRegistered)
-      {
-         throw new IllegalStateException("cannot passivate persistence context with active transaction");
-      }
-      //need to create a context, because this can get called
-      //outside the JSF request, and we want to use the
-      //PersistenceProvider object
-      boolean createContext = !Contexts.isApplicationContextActive();
-      if (createContext) Lifecycle.beginCall();
-      try
-      {
-         if ( entityManager!=null && !PersistenceProvider.instance().isDirty(entityManager) )
-         {
-            entityManager.close();
-            entityManager = null;
-         }
-      }
-      finally
-      {
-         if (createContext) Lifecycle.endCall();
-      }
-   }
+    public void sessionWillPassivate(HttpSessionEvent event)
+    {
+        if (synchronizationRegistered) {
+            throw new IllegalStateException("cannot passivate persistence context with active transaction");
+        }
+    }
    
-   //we can't use @PostActivate because it is intercept NEVER
-   public void sessionDidActivate(HttpSessionEvent event) {}
-   
+    //we can't use @PostActivate because it is intercept NEVER
+    public void sessionDidActivate(HttpSessionEvent event) {
+        entityManager = null;
+    }
+    
    @Destroy
    public void destroy()
    {




More information about the seam-commits mailing list