ActionQueue hasParent() StackOverflowError in Hibernate

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • Hibernate 5

Issue

  • Inserting/updating multiple entities of associated entity classes

  • The following are set in the persistence.xml properties:

                        <property name="hibernate.order_inserts" value="true" />
                        <property name="hibernate.order_updates" value="true" />
    
  • Encountering the StackOverflowError below

    Caused by: java.lang.StackOverflowError
        at org.hibernate.engine.spi.ActionQueue$InsertActionSorter$BatchIdentifier.hasParent(ActionQueue.java:1093)
        at org.hibernate.engine.spi.ActionQueue$InsertActionSorter$BatchIdentifier.hasParent(ActionQueue.java:1095)
        at org.hibernate.engine.spi.ActionQueue$InsertActionSorter$BatchIdentifier.hasParent(ActionQueue.java:1095)
        at org.hibernate.engine.spi.ActionQueue$InsertActionSorter$BatchIdentifier.hasParent(ActionQueue.java:1095)
    

Resolution

This issue1 is resolved in This content is not included.EAP 7.1 cumulative patch (CP) 6 and later releases. Production systems should use the latest available cumulative patch.

Root Cause

This is a known defect (Content from hibernate.atlassian.net is not included.HHH-12380).

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.