Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2247

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1, 2.1.2, 2.2.1, 2.3.0
    • 2.0.2, 2.1.2, 2.2.1, 2.3.0
    • kernel
    • 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.

      Attachments

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

        Activity

          People

            allee8285 Albert Lee
            curtisr7 Richard G. Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: