[jboss-jira] [JBoss JIRA] Commented: (HIBERNATE-73) @OneToOne with @PrimaryKeyJoinColumn does not work right
Emmanuel Bernard (JIRA)
jira-events at lists.jboss.org
Fri Jan 18 17:46:21 EST 2008
[ http://jira.jboss.com/jira/browse/HIBERNATE-73?page=comments#action_12395810 ]
Emmanuel Bernard commented on HIBERNATE-73:
-------------------------------------------
I was a bit short in my explanations.
I agree that the FK generation can make sense, but clearly the id generation (actually it's non generation) is totally expected, the default value for the id generator is none.
> @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