| If there is an abstract parent class with SINGLE_TABLE inheritance mapped with 2 or more child entities extending it then two subsequent fetches of different children from this table fail with WrongClassException: javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object [id=1] was not of the specified subclass [bug.ChildTwo] : loaded object was of wrong class class bug.ChildOne at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1692) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602) at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:492) due to EntityKey comparison at line 99 : ... return EqualsHelper.equals( otherKey.persister.getRootEntityName(), persister.getRootEntityName() ); Please run mvn clean test in the attached test case to reproduce. |