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
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(
at org.hibernate.type.CustomType.nullSafeGet(
at org.hibernate.type.AbstractType.hydrate(
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(
at org.hibernate.loader.Loader.loadFromResultSet(
at org.hibernate.loader.Loader.instanceNotYetLoaded(
at org.hibernate.loader.Loader.getRow(
at org.hibernate.loader.Loader.getRowFromResultSet(
at org.hibernate.loader.Loader.doQuery(
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
at org.hibernate.loader.Loader.doList(
at org.hibernate.loader.Loader.listIgnoreQueryCache(
at org.hibernate.loader.Loader.list(
at org.hibernate.loader.criteria.CriteriaLoader.list(
at org.hibernate.impl.SessionImpl.list(
at org.hibernate.impl.CriteriaImpl.list(

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