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
|
|