Enum literals of inner Enum classes require the use of $ in EJB-QL
------------------------------------------------------------------
Key: EJB-388
URL:
http://opensource.atlassian.com/projects/hibernate/browse/EJB-388
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.4.0.GA
Reporter: Onno Molenkamp
Priority: Minor
When I use an enum literal of an inner enum class in an EJB-QL query using the normal Java
syntax for enum literals, I get the following exception:
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Invalid path:
'some.package.SomeClass.SomeEnum.ENUMVALUE' [select x from some.package.SomeClass
x where x.enumproperty = some.package.SomeClass.SomeEnum.ENUMVALUE]
at
org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at
org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:258)
at
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
at
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
... 85 more
A workaround is to use the syntax some.package.SomeClass$SomeEnum.ENUMVALUE, but I think
the syntax I tried to use should also work.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira