This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Annotations mapping and Enumeration uses wrong value

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Hibernate 3.3.1.GA
Hibernate-Annotations 3.4.0.GA
hibernate-commons-annotations 3.3.0.ga
Java Persistence API 1.0

I have mapped a table using Annotations and a field in that table using Enumeration.

The field is configured like this:




The Enum:



Stack trace:

java.lang.IllegalArgumentException: Unknown name value for enum class no.bbs.bkad.domain.bankkunde.KundeAutomatiskOppdatering: 0
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.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)


The field should be store in the table as a value (0, 1 or 2). The database column CUST_AUTO_UPDATE is a number.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic