Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

open JPA throws exception on using Enum

 
Pallavi ch
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We have few complex queries to retreive data from database.
started with JPA native named queries.

when I map enum to the filed, JPA throws following exception:



I'm mapping attribute as enum on orm.xml.



I've treid with annotation too.
Getting the same exception..

Any suggestion on this??
Im usign open JPA 1.1.1 version
and sybase database

Thanks,
Lavanya.
 
Pallavi ch
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just realized... Query always returning NULL values for enum from the database, altough database has values.

Read in other forum, enum always loaded as Lazy, need to make it EAGER to get the values.

http://openjpa.208410.n2.nabble.com/OpenJPA-MySQL-Environment-NamedQuery-always-returns-null-for-Enumerated-column-types-td216529.html

I've tried this



but NO luck

Switched to Annotation, and saw the real error in exception stack trace.
error is Query refering to enum values instead of variables.
fixed it and switched back to XML elemenets.
Thanks!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic