org.hibernate.WrongClassException: Object with id: 592 was not of the specified subclass: pojo.Product (Discriminator: ChildProduct)


Solutions on the web

Solution icon of hibernate
via Hibernate JIRA by Nicolas Bouillon, 1 year ago
Object with id: 592 was not of the specified subclass: pojo.Product (Discriminator: ChildProduct)

Solution icon of hibernate
via Hibernate JIRA by Nicolas Bouillon, 1 year ago
Object with id: 592 was not of the specified subclass: pojo.Product (Discriminator: ChildProduct)

Solution icon of stackoverflow
Object with id: 261 was not of the specified subclass: com.lmig.lit.lpew.model.criteria.SearchCriteria (Discriminator: DATE )

Solution icon of sourceforge
Object with id: 1 was not of the specified subclass: org.openxava.invoicing.model.CommercialDocument (Discriminator: 0)


Stack trace

org.hibernate.WrongClassException: Object with id: 592 was not of the specified subclass: pojo.Product (Discriminator: ChildProduct)
	at org.hibernate.loader.Loader.getInstanceClass(Loader.java:1626)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1460)
	at org.hibernate.loader.Loader.getRow(Loader.java:1384)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:640)
	at org.hibernate.loader.Loader.doQuery(Loader.java:856)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.loadCollection(Loader.java:2175)
	at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:61)
	at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:622)
	at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:82)
	at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1606)
	at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:379)
	at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:112)
	at org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:266)

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

Once, 11 months ago