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

Emmanuel Bernard (JIRA) jira-events at lists.jboss.org
Mon May 5 11:18:21 EDT 2008


    [ http://jira.jboss.com/jira/browse/HIBERNATE-73?page=comments#action_12411780 ] 
            
Emmanuel Bernard commented on HIBERNATE-73:
-------------------------------------------

Where does the Example 2 talk about id generation? Nowhere.
The FK is not generated (FK generation is not part of the spec) and I already said it would be a nice thing to do.
Aside from that this mapping works as expected by the spec in Hibernate: the TCK tests it.


> @OneToOne with @PrimaryKeyJoinColumn does not work right
> --------------------------------------------------------
>
>                 Key: HIBERNATE-73
>                 URL: http://jira.jboss.com/jira/browse/HIBERNATE-73
>             Project: Hibernate
>          Issue Type: Bug
>         Environment: JBoss 4.2.1
>            Reporter: Tim McCune
>         Assigned To: Steve Ebersole
>
> 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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list