myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1135647 - /myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/DefaultTransactionalInterceptorStrategy.java
Date Tue, 14 Jun 2011 15:25:01 GMT
Author: struberg
Date: Tue Jun 14 15:25:00 2011
New Revision: 1135647

URL: http://svn.apache.org/viewvc?rev=1135647&view=rev
Log:
EXTCDI-200 flush EntityManagers before commits

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/DefaultTransactionalInterceptorStrategy.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/DefaultTransactionalInterceptorStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/DefaultTransactionalInterceptorStrategy.java?rev=1135647&r1=1135646&r2=1135647&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/DefaultTransactionalInterceptorStrategy.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jpa-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jpa/impl/DefaultTransactionalInterceptorStrategy.java
Tue Jun 14 15:25:00 2011
@@ -275,6 +275,22 @@ public class DefaultTransactionalInterce
                     // them already
                     if (firstException == null)
                     {
+                        // first flush all EntityManagers
+                        for (EntityManager currentEntityManager : entityManagerMap.get().values())
+                        {
+                            try
+                            {
+                                currentEntityManager.flush();
+                            }
+                            catch (Exception e)
+                            {
+                                firstException = e;
+                                commitFailed = true;
+                                break;
+                            }
+                        }
+
+                        // and finally do all the commits
                         for (EntityManager currentEntityManager : entityManagerMap.get().values())
                         {
                             transaction = currentEntityManager.getTransaction();



Mime
View raw message