java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Probela con enums
    via openxava by diegoazd
    ,
  • Hibernate Exception - Unknown name value
    via Stack Overflow by Reddy
    ,
  • Single table inheritance with enum type
    via Stack Overflow by user1735704
    ,
  • Using Regular SQL, the retrieval of a bean with an enum type does not seem to work. ======= SQL Below Does not Work ======= SQLQuery q = hSession.createSQLQuery("select {tb.*} from TestBean tb where name=:name"); q.setString("name",aName); q.addEntity("tb",TestBean.class); return((TestBean)q.uniqueResult()); ======== HQL Below Works ======== Query q = hSession.createQuery("from TestBean tb where name=:name"); q.setString("name",aName); return((TestBean )q.uniqueResult()); ======== Enum Class ======== public enum LevelEnum { AN, RE; } ======== TestBean Class ======== import javax.persistence.*; public class TestBean public LevelEnum getLevel() { return level; } public void setLevel(LevelEnum level) { this.level = level; } private LevelEnum level; ======== java.lang.IllegalArgumentException: Unknown ordinal value for enum class LevelEnum: 257 at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:92) at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:104) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300) at org.hibernate.loader.Loader.getRow(Loader.java:1197) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569) at org.hibernate.loader.Loader.doQuery(Loader.java:689) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2150) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1672) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:147) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
    via by hiberdude,
  • Using Regular SQL, the retrieval of a bean with an enum type does not seem to work. ======= SQL Below Does not Work ======= SQLQuery q = hSession.createSQLQuery("select {tb.*} from TestBean tb where name=:name"); q.setString("name",aName); q.addEntity("tb",TestBean.class); return((TestBean)q.uniqueResult()); ======== HQL Below Works ======== Query q = hSession.createQuery("from TestBean tb where name=:name"); q.setString("name",aName); return((TestBean )q.uniqueResult()); ======== Enum Class ======== public enum LevelEnum { AN, RE; } ======== TestBean Class ======== import javax.persistence.*; public class TestBean public LevelEnum getLevel() { return level; } public void setLevel(LevelEnum level) { this.level = level; } private LevelEnum level; ======== java.lang.IllegalArgumentException: Unknown ordinal value for enum class LevelEnum: 257 at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:92) at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:104) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300) at org.hibernate.loader.Loader.getRow(Loader.java:1197) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569) at org.hibernate.loader.Loader.doQuery(Loader.java:689) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2150) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:117) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1672) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:147) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:169)
    via by hiberdude,
    • java.lang.IllegalArgumentException: Unknown name value for enum class org.openxava.gestion.modelo.Elementosinternet$TipoConexion: 1 at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:113) at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:128) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2124) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332) at org.hibernate.loader.Loader.getRow(Loader.java:1230) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603) at org.hibernate.loader.Loader.doQuery(Loader.java:724) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.loadEntity(Loader.java:1881) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:71) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:65) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3072) at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:434) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:415) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905) at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842) at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835) at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182) at org.openxava.model.impl.JPAPersistenceProvider.find(JPAPersistenceProvider.java:25) at org.openxava.model.impl.POJOPersistenceProviderBase.find(POJOPersistenceProviderBase.java:89) at org.openxava.model.impl.POJOPersistenceProviderBase.find(POJOPersistenceProviderBase.java:60) at org.openxava.model.impl.MapFacadeBean.findEntity(MapFacadeBean.java:1410) at org.openxava.model.impl.MapFacadeBean.findEntity(MapFacadeBean.java:1550) at org.openxava.model.impl.MapFacadeBean.getValuesImpl(MapFacadeBean.java:602) at org.openxava.model.impl.MapFacadeBean.getValues(MapFacadeBean.java:93) at org.openxava.model.MapFacade.getValues(MapFacade.java:359) at org.openxava.actions.SearchByViewKeyAction.execute(SearchByViewKeyAction.java:52) at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:310) at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:229) at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:420) at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:229) at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:420) at org.openxava.controller.ModuleManager.executeAction(ModuleManager.java:229) at org.openxava.controller.ModuleManager.execute(ModuleManager.java:195)
    No Bugmate found.