OPENJPA-595. Porting to 1.1.x branch.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.1.x@655657 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2008-05-12 21:42:57 +00:00
parent b56f30427f
commit 75309a2447
2 changed files with 10 additions and 2 deletions

View File

@ -1322,8 +1322,11 @@ public class JPQLExpressionBuilder
Object value = field.get(null); Object value = field.get(null);
return factory.newLiteral(value, Literal.TYPE_UNKNOWN); return factory.newLiteral(value, Literal.TYPE_UNKNOWN);
} catch (NoSuchFieldException nsfe) { } catch (NoSuchFieldException nsfe) {
if (node.inEnumPath)
throw parseException(EX_USER, "no-field", throw parseException(EX_USER, "no-field",
new Object[]{ c.getName(), fieldName }, nsfe); new Object[]{ c.getName(), fieldName }, nsfe);
else
return getPath(node, false, true);
} catch (Exception e) { } catch (Exception e) {
throw parseException(EX_USER, "unaccessible-field", throw parseException(EX_USER, "unaccessible-field",
new Object[]{ className, fieldName }, e); new Object[]{ className, fieldName }, e);
@ -1556,10 +1559,12 @@ public class JPQLExpressionBuilder
JPQLNode[] children; JPQLNode[] children;
String text; String text;
boolean not = false; boolean not = false;
boolean inEnumPath = false;
public JPQLNode(JPQL parser, int id) { public JPQLNode(JPQL parser, int id) {
this.id = id; this.id = id;
this.parser = parser; this.parser = parser;
this.inEnumPath = parser.inEnumPath;
} }
public void jjtOpen() { public void jjtOpen() {

View File

@ -64,6 +64,7 @@ import java.io.*;
public class JPQL public class JPQL
{ {
String jpql; String jpql;
boolean inEnumPath;
public JPQL (String jpql) public JPQL (String jpql)
@ -968,7 +969,9 @@ void enum_primary() : { }
void enum_literal() : { } void enum_literal() : { }
{ {
{ inEnumPath = true; }
path() path()
{ inEnumPath = false; }
} }