OpenJPA
  1. OpenJPA
  2. OPENJPA-2247

JoinColumn annotation is ignored when mapping a unidirectional owned OneToOne that is in a SecondaryTable

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1.2, 2.2.1, 2.3.0
    • Fix Version/s: 2.0.3, 2.1.2, 2.2.1, 2.3.0
    • Component/s: kernel
    • Labels:
      None

      Description

      The runtime incorrectly ignores @JoinColumn.name when mapping a unidirectional owned OneToOne that is in a SecondaryTable.

      This problem only exists when running with a persistence.xml that is set to 2.0 (version="2.0">).

      For example:

      @Entity
      @SecondaryTable(name = "ParentSecondaryTable", pkJoinColumns =

      { @PrimaryKeyJoinColumn(name = "idParent", referencedColumnName = "idParent") }

      )
      public class Parent

      { @Id @GeneratedValue int idParent; String child_ref; @OneToOne @JoinColumn(name = "CHILD_REF", table = "ParentSecondaryTable", referencedColumnName = "idChild") PChild child; }

      The column "CHILD_REF" will be ignored and the runtime will look for the fk in non-existent column ParentSecondaryTable.CHILD_IDCHILD.

      1. OPENJPA-2247.trunk.patch
        7 kB
        Albert Lee
      2. OPENJPA-2247.22x.patch
        11 kB
        Albert Lee
      3. OPENJPA-2247.21x.patch
        11 kB
        Albert Lee
      4. OPENJPA-2247.20x.patch
        11 kB
        Albert Lee

        Activity

        Hide
        Rick Curtis added a comment -

        Committed revision 1369043 to trunk.

        Show
        Rick Curtis added a comment - Committed revision 1369043 to trunk.
        Hide
        Albert Lee added a comment -

        Fix committed under revision 1369042 to trunk.

        Show
        Albert Lee added a comment - Fix committed under revision 1369042 to trunk.
        Hide
        Heath Thomann added a comment -

        HI! Please note that part of this fix (Revision 1369042) was incorrectly listed under JIRA OPENJPA-2229.

        Thanks,

        Heath

        Show
        Heath Thomann added a comment - HI! Please note that part of this fix (Revision 1369042) was incorrectly listed under JIRA OPENJPA-2229 . Thanks, Heath
        Hide
        Albert Lee added a comment -

        Reopen the issue to address similar problem affecting the 1x1 bi and mx1 uni use case.

        Show
        Albert Lee added a comment - Reopen the issue to address similar problem affecting the 1x1 bi and mx1 uni use case.

          People

          • Assignee:
            Albert Lee
            Reporter:
            Rick Curtis
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development