|
IllegalArgumentException "Non-entity object instance passed to evict" is thrown when an entity that (directly or indirectly) references the same entity multiple times.
For example this occurs with mappings (see attached test case also):
<hibernate-mapping>
<class entity-name="A" name="com.cyclone.hibernate.A">
<id name="id" access="field" />
<many-to-one name="b1" entity-name="B" cascade="all" />
<many-to-one name="b2" entity-name="B" cascade="all" />
</class>
<class entity-name="B" name="com.cyclone.hibernate.B">
<id name="id" access="field" />
</class>
</hibernate-mapping>
when a single A entity has both b1 and b2 set to the same B instance and A is evicted from the session.
Happens with code added for HHH-7912 which fails to get a persister the second time DefaultEvictEventListener.onEvict(...) is called for the B entity because the (guessed) entity name is the class name, and not the entity name defined in the mappings.
|