Hi, 
I have a class (Status) which implements PersistentEnum, providing both fromInt() and toInt() methods.  This 'enumerated type' is a property of a class, say Message.
I need to query the database to return all queries with a given status.   i.e.
Code:
List messages = session.find(
    "FROM Message AS message WHERE " +
    "message.status = Status.UNSENT");
This generates sql:
Code:
... from Message incoming0_ where (incoming0_.status=Status.UNSENT )
and gives the exception:
Code:
Unknown table 'Status' in where clause
I have tried all sorts of combinations of the query method signature (using Hibernate.custom(clazz), Hibernate.OBJECT, etc, etc).  All seem to give a different exception.
What is the correct what to use a PersistentEnum in a query?
Thanks
Justin