cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r606469 - in /cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa: bridge/DataMapConverter.java map/JpaAttributes.java
Date Sat, 22 Dec 2007 17:30:33 GMT
Author: aadamchik
Date: Sat Dec 22 09:30:28 2007
New Revision: 606469

URL: http://svn.apache.org/viewvc?rev=606469&view=rev
Log:
JPA: fixing target id resolving

Modified:
    cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/bridge/DataMapConverter.java
    cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java

Modified: cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/bridge/DataMapConverter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/bridge/DataMapConverter.java?rev=606469&r1=606468&r2=606469&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/bridge/DataMapConverter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/bridge/DataMapConverter.java
Sat Dec 22 09:30:28 2007
@@ -524,7 +524,7 @@
             JpaRelationship jpaRelationship = (JpaRelationship) path.getObjectParent();
             JpaEntity targetEntity = context.getEntityMap().entityForClass(
                     jpaRelationship.getTargetEntityName());
-            JpaId jpaTargetId = targetEntity.getAttributes().getId(
+            JpaId jpaTargetId = targetEntity.getAttributes().getIdForColumnName(
                     jpaJoin.getReferencedColumnName());
 
             if (jpaTargetId == null) {

Modified: cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java?rev=606469&r1=606468&r2=606469&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java
Sat Dec 22 09:30:28 2007
@@ -211,6 +211,24 @@
         return null;
     }
 
+    public JpaId getIdForColumnName(String idColumnName) {
+        if (idColumnName == null) {
+            throw new IllegalArgumentException("Null id column name");
+        }
+
+        if (ids != null) {
+            for (JpaId id : ids) {
+
+                if (id.getColumn() != null
+                        && idColumnName.equals(id.getColumn().getName())) {
+                    return id;
+                }
+            }
+        }
+
+        return null;
+    }
+
     /**
      * Returns a JpaAttribute for a given property name
      */



Mime
View raw message