openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r907853 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
Date Tue, 09 Feb 2010 00:17:50 GMT
Author: faywang
Date: Tue Feb  9 00:17:50 2010
New Revision: 907853

URL: http://svn.apache.org/viewvc?rev=907853&view=rev
Log:
OPENJPA-931: support nested embeddedId in IdClass during remove

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java?rev=907853&r1=907852&r2=907853&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
Tue Feb  9 00:17:50 2010
@@ -1012,7 +1012,9 @@
                 getPrimaryKeyIndex()];
         } else if (relmapping.getObjectIdType() == ObjectId.class && 
             relmapping.getPrimaryKeyFieldMappings()[0].getValueMapping().isEmbedded()) {
-            return j.getJoinValue(savedFieldVal, col, store);
+            if (fieldVal == null)
+                return j.getJoinValue(savedFieldVal, col, store);
+            return j.getJoinValue(fieldVal, col, store);
         }
         return j.getJoinValue(fieldVal, col, store);
     }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java?rev=907853&r1=907852&r2=907853&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMappedById.java
Tue Feb  9 00:17:50 2010
@@ -187,7 +187,7 @@
         em.close();
     }
     
-    public void testEmbeddedIdContainedInIdClass() {
+    public void testEmbeddedIdNestedInIdClass() {
         EntityManager em = emf.createEntityManager();
         EmployeeId5 eId1 = new EmployeeId5("Java", "Duke");
         Employee5 employee1 = new Employee5(eId1);
@@ -204,6 +204,12 @@
         DependentId5 depId1 = new DependentId5("1", eId1);
         Dependent5 newDep = em.find(Dependent5.class, depId1);
         assertNotNull(newDep);
+        em.getTransaction().begin();
+        em.remove(newDep);
+        em.getTransaction().commit();
+        newDep = em.find(Dependent5.class, depId1);
+        assertNull(newDep);        
+        em.close();
     }
     
     public void testCountDistinctMultiCols() {



Mime
View raw message