wood burning stoves*
The moose likes Object Relational Mapping and the fly likes open JPA throws exception on using Enum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "open JPA throws exception on using Enum" Watch "open JPA throws exception on using Enum" New topic
Author

open JPA throws exception on using Enum

Lavanya ch
Ranch Hand

Joined: Dec 16, 2004
Posts: 75
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.
Lavanya ch
Ranch Hand

Joined: Dec 16, 2004
Posts: 75
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: open JPA throws exception on using Enum
 
Similar Threads
JPA native Query - Select... where... IN, How to set list of values to setParameter()?
Problem with Enums
Got exception when running Headfirst Customer find method
enums in ejb queries
docbook & FOP