Seam SVN: r13683 - modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 22:55:52 -0400 (Tue, 31 Aug 2010)
New Revision: 13683
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
Log:
change to how the em is closed
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01 02:50:15 UTC (rev 13682)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01 02:55:52 UTC (rev 13683)
@@ -147,7 +147,10 @@
}
else
{
- delegate.close();
+ if(delegate.isOpen())
+ {
+ delegate.close();
+ }
}
} catch (SystemException e)
{
14 years, 4 months
Seam SVN: r13682 - modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 22:50:15 -0400 (Tue, 31 Aug 2010)
New Revision: 13682
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
Log:
oops
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01 02:47:04 UTC (rev 13681)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01 02:50:15 UTC (rev 13682)
@@ -109,7 +109,8 @@
}
if ("setClosed".equals(method.getName()) && method.getParameterTypes().length == 0)
{
- return provider;
+ setClosed();
+ return null;
}
return super.invoke(proxy, method, args);
}
14 years, 4 months
Seam SVN: r13681 - in modules/persistence/trunk: impl/src/main/java/org/jboss/seam/persistence and 1 other directory.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-08-31 22:47:04 -0400 (Tue, 31 Aug 2010)
New Revision: 13681
Modified:
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContext.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java
modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
modules/persistence/trunk/pom.xml
Log:
change the way the entity manager is closed
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContext.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContext.java 2010-08-31 14:41:32 UTC (rev 13680)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContext.java 2010-09-01 02:47:04 UTC (rev 13681)
@@ -42,5 +42,7 @@
public Class<?> getBeanType();
public SeamPersistenceProvider getProvider();
+
+ public void setClosed();
}
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java 2010-08-31 14:41:32 UTC (rev 13680)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextBeanLifecycle.java 2010-09-01 02:47:04 UTC (rev 13681)
@@ -123,7 +123,7 @@
public void destroy(Bean<EntityManager> bean, EntityManager em, CreationalContext<EntityManager> arg1)
{
- em.close();
+ ((ManagedPersistenceContext)em).setClosed();
arg1.release();
try
{
Modified: modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java
===================================================================
--- modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-08-31 14:41:32 UTC (rev 13680)
+++ modules/persistence/trunk/impl/src/main/java/org/jboss/seam/persistence/ManagedPersistenceContextProxyHandler.java 2010-09-01 02:47:04 UTC (rev 13681)
@@ -68,6 +68,8 @@
private final SeamPersistenceProvider provider;
private boolean persistenceContextsTouched = false;
+
+ private boolean closed = false;
static final Logger log = LoggerFactory.getLogger(ManagedPersistenceContextProxyHandler.class);
@@ -105,6 +107,10 @@
{
return provider;
}
+ if ("setClosed".equals(method.getName()) && method.getParameterTypes().length == 0)
+ {
+ return provider;
+ }
return super.invoke(proxy, method, args);
}
@@ -129,6 +135,25 @@
}
}
+ private void setClosed()
+ {
+ SeamTransaction transaction = userTransactionInstance.get();
+ try
+ {
+ if(transaction.isActive())
+ {
+ closed = true;
+ }
+ else
+ {
+ delegate.close();
+ }
+ } catch (SystemException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
private void changeFushMode(FlushModeType flushModeType)
{
provider.setFlushMode(delegate, flushModeType);
@@ -155,6 +180,10 @@
public void afterCompletion(int status)
{
synchronizationRegistered = false;
+ if(closed)
+ {
+ delegate.close();
+ }
}
public void beforeCompletion()
Modified: modules/persistence/trunk/pom.xml
===================================================================
--- modules/persistence/trunk/pom.xml 2010-08-31 14:41:32 UTC (rev 13680)
+++ modules/persistence/trunk/pom.xml 2010-09-01 02:47:04 UTC (rev 13681)
@@ -20,7 +20,7 @@
<description>
The Parent for Seam Persistence Modules
- </description>
+ </description>
<url>http://www.seamframework.org</url>
14 years, 4 months