Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Enums in EQL queries  RSS feed

 
R van Vliet
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have an odd issue, in JBoss/Hibernate the following EQL returns correct results :



Where anEnum is of type TestEnum, has enum values ENUM1,ENUM2,ENUM3 and is annotated with @Enumerated(EnumType.STRING).

However, in Glassfish/Toplink the following issue is reported :



I'm assuming my EQL syntax is dodgy and it just happens to go right in Hibernate. Can someone tell me how enums can be used in queries?

Thanks!
 
Josh Peters
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure about JPA 1, but in JPA 2, you should try using the fully-qualified name of the enum.

e.g. org.exmple.MyEnum.SOME_VALUE

Good luck!
 
Anastasia Klimchuk
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As an idea:
- to parameterize a query

- set parameter

So, to pass a value not as string, but as a enum value.
 
Anastasia Klimchuk
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh gods... just noticed that the question was asked pretty long ago
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!