Uploaded image for project: 'Hibernate ORM'
  1. HHH-10570

Entity with multiple reference to a composite-id foreign key throws EntityExistsException

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 5.1.0
    • Fix versions: None
    • Components: hibernate-core
    • Labels:
      None
    • Environment:
      Hibernate 5.1, Wildfly 10.0, Java 8
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      If an entity contains multiple reference to a composite-id foreign key, any attempt to persist/merge throws an EntityExistsException.

      Say we have Company and Customer where Customer has a id composed of a Long and a Company; it has also a Customer related. If we try to persist/merge an instance a Customer with another instance as its related, both having the same Company instance, the exception is thrown.

      Gist example: https://gist.github.com/heruan/9cbe7ae13f94d4fc2d2c

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              heruan Giovanni Lovato
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: