org.hibernate.HibernateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I have two dynamic model entites mapped as follows: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class entity-name="Superclass" discriminator-value="A"> <id name="id" type="integer"><generator class="native"/></id> <discriminator column="DISC" type="string" /> <property name="dataA" type="string"/> <subclass entity-name="Subclass" discriminator-value="B"> <property name="dataB" type="string"/> </subclass> </class> </hibernate-mapping> When I try to persist one of them (just invoking session.persist("Superclass", new HashMap()); is enough) I get the following exception: Exception in thread "main" org.hibernate.HibernateException: instance not of expected entity type: java.util.HashMap is not a: Superclass at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3640) at org.jboss.envers.test.working.MyPersister.getSubclassEntityPersister(MyPersister.java:22) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180) at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:70) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) at org.jboss.envers.test.working.WorkingMain.main(WorkingMain.java:62)
    via by Adam Warski,
  • I have two dynamic model entites mapped as follows: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class entity-name="Superclass" discriminator-value="A"> <id name="id" type="integer"><generator class="native"/></id> <discriminator column="DISC" type="string" /> <property name="dataA" type="string"/> <subclass entity-name="Subclass" discriminator-value="B"> <property name="dataB" type="string"/> </subclass> </class> </hibernate-mapping> When I try to persist one of them (just invoking session.persist("Superclass", new HashMap()); is enough) I get the following exception: Exception in thread "main" org.hibernate.HibernateException: instance not of expected entity type: java.util.HashMap is not a: Superclass at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3640) at org.jboss.envers.test.working.MyPersister.getSubclassEntityPersister(MyPersister.java:22) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180) at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:70) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) at org.jboss.envers.test.working.WorkingMain.main(WorkingMain.java:62)
    via by Adam Warski,
  • Positional Parameter with IN clause in JPA
    via Stack Overflow by Steve
    ,
  • db:: 4.32::70-122 xa
    via by Unknown author,
    • org.hibernate.HibernateException: instance not of expected entity type: java.util.HashMap is not a: Superclass at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3640) at org.jboss.envers.test.working.MyPersister.getSubclassEntityPersister(MyPersister.java:22) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180) at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:70) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) at org.jboss.envers.test.working.WorkingMain.main(WorkingMain.java:62)
    No Bugmate found.