openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r886055 - 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 Wed, 02 Dec 2009 05:45:56 GMT
Author: faywang
Date: Wed Dec  2 05:45:56 2009
New Revision: 886055

URL: http://svn.apache.org/viewvc?rev=886055&view=rev
Log:
OPENJPA-931: derived identity support 

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=886055&r1=886054&r2=886055&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
Wed Dec  2 05:45:56 2009
@@ -996,7 +996,7 @@
 
         ClassMapping relmapping = field.getTypeMapping();
         Joinable j = field.getTypeMapping().assertJoinable(col);
-        if (ImplHelper.isManageable(fieldVal))
+        if (ImplHelper.isManageable(fieldVal) && !field.getDefiningMetaData().useIdClassFromParent())
             fieldVal = store.getContext().getObjectId(fieldVal);
         if (fieldVal instanceof OpenJPAId)
             fieldVal = ((OpenJPAId) fieldVal).getIdObject();

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=886055&r1=886054&r2=886055&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
Wed Dec  2 05:45:56 2009
@@ -605,6 +605,11 @@
         Person3 p0 = persons3.get("f_1");
         Person3 p1 = p.getMedical().getPatient();
         assertEquals(p, p1);
+        em.clear();
+        
+        MedicalHistory3 m = em.find(MedicalHistory3.class, new PersonId3("f_1", "l_1"));
+        MedicalHistory3 m0 = medicals3.get("f_1");
+        assertEquals(m, m0);
     }
 
     public void queryObj6() { 
@@ -665,6 +670,11 @@
         Person4 p0 = persons4.get("f_1");
         Person4 p1 = p.getMedical().getPatient();
         assertEquals(p1, p);
+        em.clear();
+        
+        MedicalHistory4 m = em.find(MedicalHistory4.class, new PersonId4("f_1", "l_1"));
+        MedicalHistory4 m0 = medicals4.get("f_1");
+        assertEquals(m, m0);
     }
 
     public void queryObj7() {



Mime
View raw message