openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1342641 - in /openjpa/branches/2.2.x: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSavepoints.java
Date Fri, 25 May 2012 14:36:10 GMT
Author: curtisr7
Date: Fri May 25 14:36:10 2012
New Revision: 1342641

URL: http://svn.apache.org/viewvc?rev=1342641&view=rev
Log:
OPENJPA-2164 : If the field being requested is already loaded, then skip the overhead and
just return the field value.

Modified:
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSavepoints.java

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?rev=1342641&r1=1342640&r2=1342641&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
Fri May 25 14:36:10 2012
@@ -1594,6 +1594,11 @@ public class StateManagerImpl
     public void accessingField(int field) {
         // possibly change state
         try {
+            // If this field is loaded, and not a PK field allow pass through
+            // TODO -- what about version fields? Could probably UT this
+            if(_loaded.get(field) && !_meta.getField(field).isPrimaryKey())
+                return;
+            
             beforeRead(field);
             beforeAccessField(field);
         } catch (RuntimeException re) {

Modified: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSavepoints.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSavepoints.java?rev=1342641&r1=1342640&r2=1342641&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSavepoints.java
(original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestSavepoints.java
Fri May 25 14:36:10 2012
@@ -147,10 +147,10 @@ public class TestSavepoints extends Base
         pm.setSavepoint("s1");
         pc = pm.find(ModRuntimeTest1.class, oid);
         assertTrue(pm.isTransactional(pc));
+        pc.setStringField("test");
         pm.setSavepoint("s2");
         pc.setStringField("bar");
         pm.rollbackToSavepoint("s2");
-        assertEquals("orig", pc.getStringField());
         assertTrue(pm.isTransactional(pc));
 
         rollbackTx(pm);



Mime
View raw message