I get error org.hibernate.HibernateException: Encountered problem trying to hydrate identifier for entity [SingleTableEntityPersister(biz.mbisoftware.fn.ejb.entity.MbiTermi)] with this stack trace as the cause: Caused by: java.lang.IllegalArgumentException: Unknown ordinal value [40] for enum class [biz.mbisoftware.fn.datatypes.DeliveryDateType] at org.hibernate.type.EnumType$OrdinalEnumValueMapper.fromOrdinal(EnumType.java:391) [hibernate-core-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.type.EnumType$OrdinalEnumValueMapper.getValue(EnumType.java:381) [hibernate-core-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.type.EnumType.nullSafeGet(EnumType.java:107) [hibernate-core-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:127) [hibernate-core-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.type.AbstractType.hydrate(AbstractType.java:106) [hibernate-core-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.type.ComponentType.hydrate(ComponentType.java:643) [hibernate-core-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.readIdentifierHydratedState(EntityReferenceInitializerImpl.java:117) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
In other cases, where a "normal" field has an enum datatype with @Convert/@Converter class this work just fine. But in this case the entity class has a combined primary class of three fields, one of them is of enum datatype (DeliveryDateType). Adding @Convert( converter = DeliveryDateType.Converter.class ) also to the PK field did not help. @Convert/@Converter class seem not to be taken into account here, as Hibernate is searching for an enum with ordinal value of 40.
@Entity @IdClass( value = MbiTermi.PK.class ) @Table( name = "mbi_termi" ) public class MbiTermi implements Serializable { .... @Id @Column( name = "termin_art", nullable = false ) @Convert( converter = DeliveryDateType.Converter.class ) private DeliveryDateType terminArt; ... public static class PK implements Serializable { ... @Convert( converter = DeliveryDateType.Converter.class ) private DeliveryDateType terminArt; ... } } What's the right way which is working? Or may this be a bug in ORM 4.3.0?
P.S.: with or without @Convert in PK class makes no difference. Also changing Converter to "autoApply = true" and removing all @Convert annotations gives the same problem.
|