openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r654626 - in /openjpa/trunk/openjpa-kernel/src/main: java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
Date Thu, 08 May 2008 21:24:55 GMT
Author: fancy
Date: Thu May  8 14:24:47 2008
New Revision: 654626

URL: http://svn.apache.org/viewvc?rev=654626&view=rev
Log:
OPENJPA-595 A common path() action in JPQL.jjt being used for Enum literal causes a simple
aliase resolution to fail

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
    openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=654626&r1=654625&r2=654626&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Thu May  8 14:24:47 2008
@@ -1322,8 +1322,11 @@
                 Object value = field.get(null);
                 return factory.newLiteral(value, Literal.TYPE_UNKNOWN);
             } catch (NoSuchFieldException nsfe) {
-                throw parseException(EX_USER, "no-field",
-                    new Object[]{ c.getName(), fieldName }, nsfe);
+                if (node.parser.inEnumPath)
+                    throw parseException(EX_USER, "no-field",
+                        new Object[]{ c.getName(), fieldName }, nsfe);
+                else
+                    return getPath(node, false, true);
             } catch (Exception e) {
                 throw parseException(EX_USER, "unaccessible-field",
                     new Object[]{ className, fieldName }, e);

Modified: openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt?rev=654626&r1=654625&r2=654626&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt (original)
+++ openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt Thu
May  8 14:24:47 2008
@@ -64,6 +64,7 @@
 public class JPQL
 {
 	String jpql;
+	boolean inEnumPath;
 
 
 	public JPQL (String jpql)
@@ -968,7 +969,9 @@
 
 void enum_literal() : { }
 {
+	{ inEnumPath = true; }
 	path()
+	{ inEnumPath = false; }
 }
 
 



Mime
View raw message