cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r546259 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser: CompiledExpression.java Compiler.java
Date Mon, 11 Jun 2007 20:23:02 GMT
Author: aadamchik
Date: Mon Jun 11 13:23:00 2007
New Revision: 546259

URL: http://svn.apache.org/viewvc?view=rev&rev=546259
Log:
EJBQL joins processing - fixing path normalization

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/CompiledExpression.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/CompiledExpression.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/CompiledExpression.java?view=diff&rev=546259&r1=546258&r2=546259
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/CompiledExpression.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/CompiledExpression.java
Mon Jun 11 13:23:00 2007
@@ -44,15 +44,8 @@
             return null;
         }
 
-        // per JPA spec, 4.4.2, "Identification variables are case insensitive."
-
-        int pathSeparator = idVariable.indexOf('.');
-        idVariable = pathSeparator < 0 ? idVariable.toLowerCase() : idVariable.substring(
-                0,
-                pathSeparator).toLowerCase()
-                + idVariable.substring(pathSeparator);
-
-        return (ClassDescriptor) descriptorsById.get(idVariable);
+        return (ClassDescriptor) descriptorsById
+                .get(Compiler.normalizeIdPath(idVariable));
     }
 
     public ClassDescriptor getRootDescriptor() {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java?view=diff&rev=546259&r1=546258&r2=546259
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/Compiler.java
Mon Jun 11 13:23:00 2007
@@ -75,6 +75,17 @@
         return compiled;
     }
 
+    static String normalizeIdPath(String idPath) {
+        
+        // per JPA spec, 4.4.2, "Identification variables are case insensitive."
+        
+        int pathSeparator = idPath.indexOf('.');
+        return pathSeparator < 0 ? idPath.toLowerCase() : idPath.substring(
+                0,
+                pathSeparator).toLowerCase()
+                + idPath.substring(pathSeparator);
+    }
+
     class CompilationVisitor extends EJBQLDelegatingVisitor {
 
         CompilationVisitor() {
@@ -142,8 +153,7 @@
         public boolean visitIdentifier(EJBQLExpression expression) {
 
             // per JPA spec, 4.4.2, "Identification variables are case insensitive."
-            String rootId = expression.getText();
-            rootId = rootId.toLowerCase();
+            rootId = normalizeIdPath(expression.getText());
 
             // resolve class descriptor
             ClassDescriptor descriptor = resolver.getClassDescriptor(entityName);
@@ -230,7 +240,7 @@
         public boolean visitPath(EJBQLPath expression, int finishedChildIndex) {
             if (finishedChildIndex < 0) {
 
-                String id = expression.getId();
+                String id = normalizeIdPath(expression.getId());
 
                 ClassDescriptor descriptor = (ClassDescriptor) descriptorsById.get(id);
                 if (descriptor == null) {



Mime
View raw message