From: Thomas R. (JIRA) <no...@at...> - 2006-06-06 21:34:37
|
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-361?page=comments#action_23286 ] Thomas Risberg commented on ANN-361: ------------------------------------ Looking at the JPA Spec page 196, Example 2 - here the annotations are applied the same way I have them applied in my example. Does this mean that you are not going to support this? Wouldn't that in turn indicate that you would not be fully spec compliant? Any clarification would be helpful. Thanks, >From the JPA Spec page 196: Example 2: OneToOne relationship between Employee and EmployeeInfo classes public class EmpPK { public Integer id; public String name; } @Entity @IdClass(com.acme.EmpPK.class) public class Employee { @Id Integer id; @Id String name; @OneToOne @PrimaryKeyJoinColumns({ @PrimaryKeyJoinColumn(name="ID", referencedColumn-Name="EMP_ID"), @PrimaryKeyJoinColumn(name="NAME", referencedColumn-Name="EMP_NAME")}) EmployeeInfo info; ... } @Entity @IdClass(com.acme.EmpPK.class) public class EmployeeInfo { @Id @Column(name="EMP_ID") Integer id; @Id @Column(name="EMP_NAME") String name; ... } > @Column(name="xxxx") does not work when composit key is used > ------------------------------------------------------------ > > Key: ANN-361 > URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-361 > Project: Hibernate Annotations > Type: Bug > Versions: 3.2.0.cr1 > Reporter: Thomas Risberg > > > When using a composit key and specifying name of id column - the specified name is ignored and a column with the name of the field is generated. > This: > ------------- > import java.io.Serializable; > public class ProductItemPK implements Serializable { > private Long productId; > private Long itemId; > } > ------------- > import javax.persistence.*; > @Entity > @IdClass(value=ProductItemPK.class) > public class ProductItem { > @Id > @Column(name="product_id") > private Long productId; > @Id > @Column(name="item_id") > private Long itemId; > private String name; > } > ------------- > results in: > create table ProductItem ( > productId number(19,0) not null, > itemId number(19,0) not null, > name varchar2(255 char), > primary key (productId, itemId) > ) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |