How to use Enum as NamedQuery parameters in JPA

Posted by n002213f on Stack Overflow See other posts from Stack Overflow or by n002213f
Published on 2010-05-12T13:21:06Z Indexed on 2010/05/12 13:24 UTC
Read the original article Hit count: 692

Filed under:
|
|

I have an Entity with a enum attribute and a couple on NamedQueries. One of these NamedQueries has a the enum attribute as a parameter i.e.

SELECT m FROM Message m WHERE status = :status

When i try to ru n the query i get the following error;

Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type class my.package.Status for parameter status with expected type of class my.package.Status from query string SELECT m FROM Message m WHERE m.status = :status.

I'm using Toplink

How is this? How would i make JPA happy?

© Stack Overflow or respective owner

Related posts about jpa

Related posts about toplink