net.sf.hibernate.WrongClassException: Object with id: 21 was not of the specified subclass: test.A (loaded object was of wrong class)

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Hibernate JIRA by alexander thomas, 1 year ago
Object with id: 21 was not of the specified subclass: test.A (loaded object was of wrong class)
via Hibernate JIRA by alexander thomas, 1 year ago
Object with id: 21 was not of the specified subclass: test.A (loaded object was of wrong class)
via Hibernate JIRA by Marko Nikolic, 1 year ago
Object with id: 12 was not of the specified subclass: com.redstarshop.data.File (loaded object was of wrong class)
via Hibernate JIRA by Marko Nikolic, 1 year ago
Object with id: 12 was not of the specified subclass: com.redstarshop.data.File (loaded object was of wrong class)
via Hibernate JIRA by Sam Perman, 1 year ago
Object with id: 1346 was not of the specified subclass: my.BarImpl(loaded object was of wrong class)
via Hibernate JIRA by Sam Perman, 1 year ago
Object with id: 1346 was not of the specified subclass: my.BarImpl(loaded object was of wrong class)
net.sf.hibernate.WrongClassException: Object with id: 21 was not of the specified subclass: test.A (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)

Users with the same issue

You are the first who have seen this exception. Write a tip to help other users and build your expert profile.

Know the solutions? Share your knowledge to help other developers to debug faster.