Skip to content

Territory membership and application roles are mapped as two owners of one join table #297

Closed as not planned

Description

@fjlopez

Describe the bug
Territory.members and Territory.memberOf both own STM_GRP_TER. The join columns are swapped. Neither side uses mappedBy. Both cascade MERGE and PERSIST. Application.availableRoles and Role.applications both own STM_APP_ROL the same way.

The territory form writes members and memberOf through separate tabs. A type that is neither top nor bottom shows both tabs, and each tab calls substituteAllRelation. The application form writes availableRoles. The role form writes applications. If both collections are initialized and one side is empty or stale, flush deletes the join rows for that owner and writes the in-memory set back.

To Reproduce

  1. Load a territory whose type shows both membership tabs, with one tab's relation left empty or stale.
  2. Save.
  3. Read STM_GRP_TER for that territory.
  4. Repeat from the application form and the role form for STM_APP_ROL.

Expected behavior
Each join table has one owning side. Saving one form does not delete links that the other side still holds.

Additional context
Territory.members, Territory.memberOf, Application.availableRoles, Role.applications. Schema primary key of STM_GRP_TER is (GTE_TERMID, GTE_TERID).

Activity

  1. added
    bugSomething isn't working
    confirmedReproduced / accepted defect; exempt from stale bot
    on Oct 16, 2026
  2. added theissue type on Oct 16, 2026
  3. fjlopez commented on Oct 22, 2026

    @fjlopez
    ContributorAuthor

    Both join owners stay. PUT on each side still writes its own rows, and replacing one side leaves the other side's row. Locked on dev by #352.

  4. fjlopez commented on Oct 22, 2026

    @fjlopez
    ContributorAuthor

    The reported data loss cannot be reproduced. Each association PUT writes its own join-table key, and replacing one side leaves the other side's rows. Both owners stay.

    #352 locks that behavior on dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconfirmedReproduced / accepted defect; exempt from stale bot

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions