openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fay Wang (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-1857) Wrong exception is thrown when JoinColumn annotation is not incorrectly specified
Date Wed, 27 Oct 2010 16:18:22 GMT
Wrong exception is thrown when JoinColumn annotation is not incorrectly specified
---------------------------------------------------------------------------------

                 Key: OPENJPA-1857
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1857
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.1.0
            Reporter: Fay Wang
            Priority: Minor
             Fix For: 2.1.0


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;
...
}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message