openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1540371 - in /openjpa/branches/2.3.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persiste...
Date Sat, 09 Nov 2013 19:26:32 GMT
Author: struberg
Date: Sat Nov  9 19:26:31 2013
New Revision: 1540371

URL: http://svn.apache.org/r1540371
Log:
OPENJPA-2335 review test case and update checks

Modified:
    openjpa/branches/2.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyInverseKeyFieldStrategy.java
    openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
    openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java

Modified: openjpa/branches/2.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyInverseKeyFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyInverseKeyFieldStrategy.java?rev=1540371&r1=1540370&r2=1540371&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyInverseKeyFieldStrategy.java
(original)
+++ openjpa/branches/2.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationToManyInverseKeyFieldStrategy.java
Sat Nov  9 19:26:31 2013
@@ -327,8 +327,7 @@ public abstract class RelationToManyInve
             if (sm != null && sm.isDeleted())
                 sm = null;
             writeable = io.isAnyUpdatable(fk, sm == null);
-            orderWriteable = field.getOrderColumnIO().isUpdatable
-                (order, sm == null);
+            orderWriteable = field.getOrderColumnIO().isUpdatable(order, sm == null);
             action = Row.ACTION_UPDATE;
         }
         if (!writeable && !orderWriteable)
@@ -345,8 +344,11 @@ public abstract class RelationToManyInve
         // update the inverse pointer with our oid value
         if (writeable)
             row.setForeignKey(fk, io, sm);
-        if (orderWriteable)
+
+        if (orderWriteable) {
+            // set the OrderColumn value
             row.setInt(order, idx);
+        }
     }
 
     public Object toDataStoreValue(Object val, JDBCStore store) {

Modified: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java?rev=1540371&r1=1540370&r2=1540371&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
(original)
+++ openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestOpenJPA2330.java
Sat Nov  9 19:26:31 2013
@@ -67,19 +67,18 @@ public class TestOpenJPA2330 extends Sin
 
         EntityB b1 = new EntityB(a);
         b1.setName("b1");
+        a.getBs().add(b1);
 
         EntityB b2 = new EntityB(a);
         b2.setName("b2");
+        a.getBs().add(b2);
 
         EntityB b3 = new EntityB(a);
         b3.setName("b3");
+        a.getBs().add(b3);
 
         EntityB b4 = new EntityB(a);
         b4.setName("b4");
-
-        a.getBs().add(b1);
-        a.getBs().add(b2);
-        a.getBs().add(b3);
         a.getBs().add(b4);
 
         em.persist(a);
@@ -95,6 +94,13 @@ public class TestOpenJPA2330 extends Sin
         Assert.assertNotNull(a2.getBs());
         Assert.assertEquals(4, a2.getBs().size());
 
+        Iterator<EntityB> it = a2.getBs().iterator();
+        for (int i = 1; i <= 4; i++) {
+            EntityB entityB = it.next();
+
+            Assert.assertEquals("b" + i, entityB.getName());
+        }
+
         em.getTransaction().commit();
         em.close();
     }

Modified: openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java?rev=1540371&r1=1540370&r2=1540371&view=diff
==============================================================================
--- openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java
(original)
+++ openjpa/branches/2.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/entity/EntityB.java
Sat Nov  9 19:26:31 2013
@@ -48,10 +48,6 @@ public class EntityB {
     @OrderColumn
     private Set<EntityC> linacs;
 
-    @Column(name = "POSITION")
-    private int position;
-
-
     public EntityB() {
     }
 



Mime
View raw message