java - Unrecognized Hibernate Type when using enum in query -


i have entity class set of enums:

@entity public class {      public enum type{         first_enum((short)1),         second_enum((short)2);          private short id;          private type(short id) {             this.id = id;         }          public short getid() {             return id;         }     }      @collectiontable(name="table_name", joincolumns=@joincolumn(name="something_id"))     @column(name="type")     private set<type> types;      ... //other props + getters , setters } 

for enum made converter (whole converter package loaded @entityscan annotation) :

@converter(autoapply=true) public class typeconverter implements attributeconverter<type, integer> {      @override     public integer converttodatabasecolumn(type st) {         //implementation     }      @override     public type converttoentityattribute(integer i) {         //implementation     } } 

now when try use enum in query

... , {packagename}.something$type.first_enum member of {someobject}.something.types ... 

i stumble upon following error:

org.hibernate.queryexception: unrecognized hibernate type handling query constant ({package}.something$type.first_enum); expecting literaltype implementation or attributeconverter 

does got clue why cannot use enum in query? somehow seems enum not known hibernate. don't understand why, because class loaded when start application.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -