IllegalArgumentException: Unknown ordinal value for enum class




Asked on May 25, 2013
Hi Friends,

I am new to hibernate help me for below error.

java.lang.IllegalArgumentException: Unknown ordinal value for enum class
at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:111)
at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:132)
at org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:769)
at org.hibernate.collection.PersistentMap.readFrom(PersistentMap.java:281)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1052)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:690)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:630)
at org.hibernate.loader.Loader.doQuery(Loader.java:745)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.loadCollection(Loader.java:2062)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:628)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1853)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentMap.entrySet(PersistentMap.java:265)


Replied on May 25, 2013
Hello Ali, I think you have not used correctly
@MapKeyEnumerated, you need to use it as

@MapKeyEnumerated(EnumType.ORDINAL)
@MapKeyEnumerated(EnumType.STRING)



Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us