org.hibernate.WrongClassException

Object [id=4010] was not of the specified subclass [B2] : loaded object was of wrong class class B1

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web11

  • via Unknown by Sergiu Hlihor,
  • via Unknown by Sergiu Hlihor,
  • Stack trace

    • org.hibernate.WrongClassException: Object [id=4010] was not of the specified subclass [B2] : loaded object was of wrong class class B1 at org.hibernate.loader.Loader.instanceAlreadyLoaded(Loader.java:1550) at org.hibernate.loader.Loader.getRow(Loader.java:1503) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:725) at org.hibernate.loader.Loader.processResultSet(Loader.java:952) at org.hibernate.loader.Loader.doQuery(Loader.java:920) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:324) at org.hibernate.loader.Loader.loadCollectionBatch(Loader.java:2299) at org.hibernate.loader.collection.plan.LegacyBatchingCollectionInitializerBuilder$LegacyBatchingCollectionInitializer.initialize(LegacyBatchingCollectionInitializerBuilder.java:100) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:693) at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:92) at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1897) at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:558) at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:260) at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:554) at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:142) at org.hibernate.collection.internal.PersistentBag.get(PersistentBag.java:466)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    We couldn't find other users who have seen this exception.