[
https://issues.apache.org/jira/browse/OPENJPA-1857?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Fay Wang resolved OPENJPA-1857.
-------------------------------
Resolution: Fixed
> 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.