openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1584156 - in /openjpa/branches/2.2.x: ./ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/ openjpa-persistence-jdbc/src/test/resources/META-INF/
Date Wed, 02 Apr 2014 20:25:23 GMT
Author: hthomann
Date: Wed Apr  2 20:25:23 2014
New Revision: 1584156

URL: http://svn.apache.org/r1584156
Log:
OPENJPA-2437: transactional listeners added too late to observe begin event - back ported
Mark Struber's changes to 2.2.x.

Added:
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/
      - copied from r1584153, openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/AuditedEntry.java
      - copied unchanged from r1584153, openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/AuditedEntry.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/TestBeginEventOnTransactionListener.java
      - copied unchanged from r1584153, openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/TestBeginEventOnTransactionListener.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/X.java
      - copied unchanged from r1584153, openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/audit/X.java
Modified:
    openjpa/branches/2.2.x/   (props changed)
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml

Propchange: openjpa/branches/2.2.x/
------------------------------------------------------------------------------
  Merged /openjpa/branches/2.2.1.x:r1584153

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java?rev=1584156&r1=1584155&r2=1584156&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
Wed Apr  2 20:25:23 2014
@@ -226,8 +226,6 @@ public abstract class AbstractBrokerFact
         DelegatingStoreManager dsm = createDelegatingStoreManager();
 
         ((BrokerImpl) broker).initialize(this, dsm, managed, connRetainMode, fromDeserialization);
-        if (!fromDeserialization)
-            addListeners(broker);
 
         // if we're using remote events, register the event manager so
         // that it can broadcast commit notifications from the broker

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=1584156&r1=1584155&r2=1584156&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
Wed Apr  2 20:25:23 2014
@@ -391,6 +391,11 @@ public class BrokerImpl implements Broke
         _printParameters =
             Boolean.parseBoolean(Configurations.parseProperties(_conf.getConnectionFactoryProperties()).getProperty(
                 PRINT_PARAMETERS_CONFIG_STR, "false"));
+
+        // do it before begin event otherwise transactional listeners can't use it, see @Auditable
+        if (!fromDeserialization)
+            _factory.addListeners(this);
+
         // synch with the global transaction in progress, if any
         if (_factory.syncWithManagedTransaction(this, false))
             beginInternal();

Modified: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml?rev=1584156&r1=1584155&r2=1584156&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
(original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
Wed Apr  2 20:25:23 2014
@@ -450,4 +450,16 @@
         </properties>
     </persistence-unit>
 
+  <persistence-unit name="auditjta" transaction-type="JTA">
+    <class>org.apache.openjpa.audit.X</class>
+    <class>org.apache.openjpa.audit.AuditedEntry</class>
+
+    <properties>
+      <property name="openjpa.Auditor" value="org.apache.openjpa.audit.TestBeginEventOnTransactionListener$MockAuditor"
/>
+      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"
/>
+      <property name="openjpa.DynamicEnhancementAgent" value="false" />
+      <property name="openjpa.ManagedRuntime" value="org.apache.openjpa.jta.JTAManagedRuntime"/>
+    </properties>
+  </persistence-unit> 
+
 </persistence>



Mime
View raw message