-->
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: net.sf.hibernate.WrongClassException
PostPosted: Mon Jun 06, 2005 4:21 pm 
Newbie

Joined: Tue Mar 22, 2005 5:43 pm
Posts: 16
Location: Teksouth
Hibernate version: 2

Mapping documents: nothing

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:net.sf.hibernate.WrongClassException: Object with id: 1 was not of the specified subclass:
WsUserGroup (loaded object was of wrong class)
at net.sf.hibernate.loader.Loader.instanceAlreadyLoaded(Loader.java:300)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:278)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:159)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:102)
at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897)
at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128)
at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74)
at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:602)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:102)
at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2897)
at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128)
at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:74)
at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:177)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1959)
at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:587)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:396)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1889)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1757)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1688)


Name and version of the database you are using: MySQL 4.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

One of the conditions under which this happens is when I have 2 different hbm files for same table. I read the record & when it's in memory, I try to get same record using the other class which has different set of properties (hbm file) & I noticed the error. If I close the session and reopen between these 2 reads, then it works fine.


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.