cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r700898 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc: EJBQLDbPathTranslator.java EJBQLJoinAppender.java EJBQLPathTranslator.java
Date Wed, 01 Oct 2008 20:03:50 GMT
Author: aadamchik
Date: Wed Oct  1 13:03:49 2008
New Revision: 700898

URL: http://svn.apache.org/viewvc?rev=700898&view=rev
Log:
CAY-1114 EJBQLQuery fails on joins outside of public schema - patch  by Dave Dombrosky

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLDbPathTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLDbPathTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLDbPathTranslator.java?rev=700898&r1=700897&r2=700898&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLDbPathTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLDbPathTranslator.java
Wed Oct  1 13:03:49 2008
@@ -114,7 +114,7 @@
 
         if (oldPath != null) {
             this.idPath = oldPath;
-            this.lastAlias = context.getTableAlias(oldPath, currentEntity.getName());
+            this.lastAlias = context.getTableAlias(oldPath, currentEntity.getFullyQualifiedName());
         }
         else {
 
@@ -124,7 +124,7 @@
                         joinMarker,
                         new EJBQLTableId(idPath),
                         new EJBQLTableId(fullPath));
-                this.lastAlias = context.getTableAlias(fullPath, currentEntity.getName());
+                this.lastAlias = context.getTableAlias(fullPath, currentEntity.getFullyQualifiedName());
             }
             else {
                 joinAppender.appendOuterJoin(
@@ -136,7 +136,7 @@
                         .getRelationship(lastPathComponent);
                 DbEntity targetEntity = (DbEntity) lastRelationship.getTargetEntity();
 
-                this.lastAlias = context.getTableAlias(fullPath, targetEntity.getName());
+                this.lastAlias = context.getTableAlias(fullPath, targetEntity.getFullyQualifiedName());
             }
 
             this.idPath = newPath;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java?rev=700898&r1=700897&r2=700898&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLJoinAppender.java
Wed Oct  1 13:03:49 2008
@@ -28,8 +28,10 @@
 import org.apache.cayenne.ejbql.EJBQLExpression;
 import org.apache.cayenne.ejbql.EJBQLParserFactory;
 import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
 import org.apache.cayenne.map.DbRelationship;
+import org.apache.cayenne.map.Entity;
 
 /**
  * Handles appending joins to the content buffer at a marked position.
@@ -102,9 +104,16 @@
 
         // TODO: andrus, 1/6/2008 - move reusable join check here...
 
-        String sourceAlias = context.getTableAlias(lhsId.getEntityId(), incomingDB
-                .getSourceEntity()
-                .getName());
+        Entity sourceEntity = incomingDB.getSourceEntity();
+        String tableName;
+
+        if (sourceEntity instanceof DbEntity) {
+           tableName = ((DbEntity) sourceEntity).getFullyQualifiedName();
+        } else {
+           tableName = sourceEntity.getName();
+        }
+
+        String sourceAlias = context.getTableAlias(lhsId.getEntityId(), tableName);
 
         if (marker != null) {
             context.pushMarker(marker, false);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java?rev=700898&r1=700897&r2=700898&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java
Wed Oct  1 13:03:49 2008
@@ -122,7 +122,7 @@
         if (oldPath != null) {
             this.idPath = oldPath;
             this.lastAlias = context.getTableAlias(oldPath, currentEntity
-                    .getDbEntityName());
+                    .getDbEntity().getFullyQualifiedName());
         }
         else {
 
@@ -133,7 +133,7 @@
                         new EJBQLTableId(idPath),
                         new EJBQLTableId(fullPath));
                 this.lastAlias = context.getTableAlias(fullPath, currentEntity
-                        .getDbEntityName());
+                        .getDbEntity().getFullyQualifiedName());
             }
             else {
                 joinAppender.appendOuterJoin(
@@ -146,7 +146,7 @@
                 ObjEntity targetEntity = (ObjEntity) lastRelationship.getTargetEntity();
 
                 this.lastAlias = context.getTableAlias(fullPath, targetEntity
-                        .getDbEntityName());
+                        .getDbEntity().getFullyQualifiedName());
             }
 
             this.idPath = newPath;



Mime
View raw message