[ 
https://issues.apache.org/jira/browse/GERONIMO-5714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shawn Jiang updated GERONIMO-5714:
----------------------------------

    Priority: Minor  (was: Major)

Seems a minor issue because the old version has the same issue and no users 
reported this.

> JPA-cannot insert record relates with Foreign key writes with "mappedBy".
> -------------------------------------------------------------------------
>
>                 Key: GERONIMO-5714
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5714
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: persistence
>    Affects Versions: 3.0
>            Reporter: LiWenQin
>            Assignee: Shawn Jiang
>            Priority: Minor
>             Fix For: 3.0
>
>
> I find foreign key relationship cannot resolved used the code like below:
> Student.java//entity
> @Entity
> @Table(name="Student")
> public class Student implements Serializable {
> ...
>    @OneToMany(mappedBy="owner")
>     @OrderColumn(name="indexno")
>     private List<Course> courses; //student can choose more than one courses, 
> this is a one-to many mapping, and has foreign key
>    ...
> }
> ===============================================================
> However,  foreign key can be created in the style below:
> Student.java
> @Entity
> @Table(name="Student")
> public class Student implements Serializable {
>    ...
>     @OneToMany(cascade={CascadeType.MERGE, CascadeType.PERSIST, 
> CascadeType.REFRESH},fetch=FetchType.EAGER )
>     @JoinTable(name="Student_Course",
>                       joinColumns={
>                               @JoinColumn(name="studentId", 
> referencedColumnName="id")
>                       },
>                       inverseJoinColumns={
>                               @JoinColumn(name="courseId", 
> referencedColumnName="cid")
>                       }
>       )
>     private List<Course> courses=null;
>    ...
> }
> This problem also exists in JPA1.0 with Geronimo server.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to