-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Encountered problem trying to hydrate identifier for entity
PostPosted: Sun Dec 22, 2013 5:13 pm 
Newbie

Joined: Mon Sep 24, 2007 2:55 pm
Posts: 13
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.