OpenJPA
  1. OpenJPA
  2. OPENJPA-1857

Wrong exception is thrown when JoinColumn annotation is not incorrectly specified

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.1.0
    • Component/s: jdbc
    • Labels:
      None

      Description

      Consider the following scenario. Note that the referencedColumnName in Dependent5a.java does not exist in the target table. Currently OpenJPA throws PersistenceException. The correct exception should be ArgumentException indicating that "org.apache.openjpa.persistence.enhance.identity.Dependent5a.emp" defines a target of "xFIRSTNAME" for column "FIRSTNAME", but that target does not exist in table "Employee5".

      @Entity
      @IdClass(DependentId5.class)
      public class Dependent5a implements Serializable {

      private static final long serialVersionUID = 1L;
      @Id
      String name;

      @Id
      @JoinColumns(

      { @JoinColumn(name="FIRSTNAME", referencedColumnName="xFIRSTNAME"), @JoinColumn(name="LASTNAME", referencedColumnName="yLASTNAME") }

      )
      @ManyToOne
      Employee5 emp;
      ...
      }

      @Entity
      public class Employee5 implements Serializable

      { private static final long serialVersionUID = 1L; @EmbeddedId EmployeeId5 empId; ... }

      @Embeddable
      public class EmployeeId5 implements java.io.Serializable

      { String firstName; String lastName; ... }

        Activity

        Fay Wang created issue -
        Fay Wang made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fay Wang made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Fay Wang [ faywang ]

          People

          • Assignee:
            Fay Wang
            Reporter:
            Fay Wang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development