glassfish
  1. glassfish
  2. GLASSFISH-3507

Dependency issues if both sides of unidirectional ToMany self relationship are removed

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      3,507

      Description

      If both sides of a unidirectional ToMany (e.g. OneToMany or ManyToMany) self
      relationship are removed, the instances are removed from the database in random
      order. This might lead to a foreign key violation, if the non-owning side is
      removed first. This is b/c the join table entries are only removed when the
      owning side is removed. The non-owning side in a unidirectional relationship
      doesn't know about the relationship at all. Note, that it very much depends on
      the order of removals, if a foreign key violation occurs. The order can not be
      influenced.

      An example for a unidirectional self relationship might be if an Employee, who
      is also a manager has a collection of managed Employees, but the Employees don't
      have a relationship field.

      To solve this problem, the way removals from join tables are done in TLE must be
      changed. Currently, join table entries are removed when the owning side is
      removed. A possible fix would introduce a phase removing join table entries
      before the associated instances are removed.

      This issue is filed as a follow-up for issue 2991.

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6593462>

        Show
        gfbugbridge added a comment - <BT6593462>
        Hide
        vladperl added a comment -

        added myself to cc

        Show
        vladperl added a comment - added myself to cc
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

          People

          • Assignee:
            tware
            Reporter:
            mf125085
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: