Emond Papegaaij ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDA5MjEzYmNj... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-15699?atlOrigin=eyJpIjoiZDA5Mj... ) HHH-15699 ( https://hibernate.atlassian.net/browse/HHH-15699?atlOrigin=eyJpIjoiZDA5Mj... ) HibernateException: Found shared references to a collection ( https://hibernate.atlassian.net/browse/HHH-15699?atlOrigin=eyJpIjoiZDA5Mj... )
Issue Type: Bug Assignee: Unassigned Components: hibernate-core Created: 09/Nov/2022 07:37 AM Priority: Major Reporter: Emond Papegaaij ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
With the migration to WildFly 27, we are getting the exception below. The exception is triggered because the same parent entity is loaded into the session twice and both share the same collection. I’ve managed to narrow the cause to the following list of factors:
* <shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode> in persistence.xml
* @Inheritance(strategy = InheritanceType.SINGLE_TABLE) on the parent entity, with at least one sub type.
* The @OneToMany in the base type of the parent entity.
* A back-reference with a @ManyToOne
I’ve attached a testcase showcasing the problem.
Caused by: org.hibernate.HibernateException: Found shared references to a collection: nl.topicus.keyhub.model.provisioning.PProvisionedSystem.accounts
at org.hibernate@6.1.3.Final//org.hibernate.engine.internal.Collections.processReachableCollection(Collections.java:188)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.FlushVisitor.processCollection(FlushVisitor.java:54)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:92)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:59)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:53)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)
at org.hibernate@6.1.3.Final//org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:214)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:90)
at org.hibernate@6.1.3.Final//org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38)
at org.hibernate@6.1.3.Final//org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107)
at org.hibernate@6.1.3.Final//org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1422)
... 59 more
( https://hibernate.atlassian.net/browse/HHH-15699#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-15699#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100210- sha1:ffe1a02 )