I always use something of the form
"SELECT i FROM Item WHERE i.status = :value"
query.setParameter( "value", ItemStatus.New.ordinal() );
since my enums are materialized as integers in the DB. It is related
to the @Enumerated annotation. Using that annotation, you can specify
that your enum type should be stored as an ordinal or as a String.
You can maybe try to specify your enum as a String and then see if
what you try will work any better.
Christian
On 11/12/07, Marc Siegel <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
> Say I have an entity Item, with an @Enumerated column 'status'.
>
> How can I have a named query like this:
> "SELECT i FROM Item WHERE i.status = 'New' "
>
> I've tried
> "SELECT i FROM Item WHERE i.status = 'New' "
> "SELECT i FROM Item WHERE i.status.name = 'New' "
> "SELECT i FROM Item WHERE i.status = ItemStatus.New "
> "SELECT i FROM Item WHERE i.status = com.xyz.lib.ItemStatus.New "
>
> To no avail. Any help?
>
> Thanks
> -Marc
>