[jboss-jira] [JBoss JIRA] Closed: (HIBERNATE-73) @OneToOne with @PrimaryKeyJoinColumn does not work right

Steve Ebersole (JIRA) jira-events at lists.jboss.org
Wed Sep 10 10:20:37 EDT 2008


     [ https://jira.jboss.org/jira/browse/HIBERNATE-73?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HIBERNATE-73.
-----------------------------------

    Resolution: Done
      Assignee: Emmanuel Bernard  (was: Steve Ebersole)


1) this project is intended for issue tracking *wrt integration between Hibernate and JBoss AS*.  The tracking system you want is: http://opensource.atlassian.com/projects/hibernate
2) This does in fact work correctly in hbm.xml usage.  Basically, when <one-to-one ... contrained="true"/> is specified on one side of the association, the FK is generated in the expected manner.  Probably annotations should set the constrained setting on the metamodel when mappedBy is used.  Not sure how annotations should handle it for uni-directional one-to-ones.

> @OneToOne with @PrimaryKeyJoinColumn does not work right
> --------------------------------------------------------
>
>                 Key: HIBERNATE-73
>                 URL: https://jira.jboss.org/jira/browse/HIBERNATE-73
>             Project: Hibernate
>          Issue Type: Bug
>         Environment: JBoss 4.2.1
>            Reporter: Tim McCune
>            Assignee: Emmanuel Bernard
>
> Given the following code:
> @Entity
> public class Employee {
>   @Id Integer id;
>     
>   @OneToOne @PrimaryKeyJoinColumn
>   EmployeeInfo info;
>   ...
> }
> @Entity
>  public class EmployeeInfo {
>    @Id Integer id;
>         ...
> }
> Hibernate creates EMPLOYEE and EMPLOYEEINFO tables, but does not create a foreign key relationship from EMPLOYEEINFO to EMPLOYEE.
> Furthermore, Hibernate does not set the EmployeeInfo's id correctly when persisting it.  The following code:
> EmployeeInfo info = new EmployeeInfo();
> employee.setInfo(info);
> does insert a new row into EMPLOYEEINFO, but it has an id of "1" when it should have an id that is the same as the corresponding Employee.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list