I'm trying to switch an application that worked fine in Hibernate to ObjectDB and am having issues with queries that reference enum types. On my entity object is a static enum
public static enum Type { A,B,C }
that is stored in an @Enumerated member variable
private Type type; @Enumerated public Type getType() { return type; }
I then try to query this field in the following JPA Named Query
@NamedQuery(name = "TestQuery", query = "select obj from Obj where obj.type = com.my.fully.qualified.name.Obj.Type.A")
but i get an ObjectDB UserException
com.objectdb.o.UserException: Field 'Type' is not found in type 'com.my.fully.qualified.name.Obj'
I have noticed that my entities seem not to be getting picked up as entities until they are first persisted - Hibernate used to scan my @Entity classes and create tables before the application even started whereas my ObjectDB database file isnt being created until the first EntityManager flush, so maybe that has something to do with it.
I've tried changing the @Enumerated to String type without success. Thats how I had it working with Hibernate - with just the quoted name string of the enum type in the query. ObjectDB didnt like that.
As far as I can tell, I'm doing everything correct according to the JPA Persistable Types page
Thanks for the help