-->
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: "Provided id of the wrong type. Expect..." in 3.2.
PostPosted: Thu Mar 01, 2007 1:08 pm 
Newbie

Joined: Wed Jan 04, 2006 10:50 pm
Posts: 3
Location: Brazil
We had using the Hibernate version 3.1.0 and I tried to change to new version 3.2.2. But occoured the follow problem (piece of hibernate code):

Class idClass = persister.getIdentifierType().getReturnedClass();
if ( idClass != null && ! idClass.isInstance( event.getEntityId() ) ) {
throw new TypeMismatchException("Provided id of the wrong type. Expected: " + idClass + ", got " + event.getEntityId().getClass());
}


A piece of my HBM:

<id name="key" column="USRO_DK" type=" util.KeyToLongUserType">
<generator class=" util.SequenceKeyGenerator">
<param name="sequence">SCAC_SQ_USRO_DK</param>
</generator>
</id>


The column USRO_DK is BIGINT type but my Entity ID is a class Key. I developed a UserType to convert its.

The error:

07/03/01 13:18:02 Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Long, got class gov.mp.rj.framework.model.Key
07/03/01 13:18:02 at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86)
07/03/01 13:18:02 at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
07/03/01 13:18:02 at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846)
07/03/01 13:18:02 at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557)
07/03/01 13:18:02 at org.hibernate.type.EntityType.resolve(EntityType.java:379)
07/03/01 13:18:02 at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
07/03/01 13:18:02 at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
07/03/01 13:18:02 at org.hibernate.loader.Loader.doQuery(Loader.java:717)


Why? Thanks.

_________________
Leonardo Pereira
Rio de Janeiro, Brazil


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.