Talk:Java Persistence/OneToOne

The example in section "Example of cascaded primary keys and mixed OneToOne and ManyToOne mapping annotations using PrimaryKeyJoinColumn" seems all wrong. PrimaryKeyJoinColumn is used on classes only (cf. ejb3 spec 9.1.32: PrimaryKeyJoinColumn annotation.)


 * Nope, this is correct. Although one of the less understood parts of the spec, PrimaryKeyJoinColumn can be used on OneToOne mapping.  The annotations is not restricted to class, and allows field/method.  The class comment also define usage in a OneToOne mapping.
 * See, https://java.sun.com/javaee/5/docs/api/javax/persistence/PrimaryKeyJoinColumn.html.
 * James (talk) 13:41, 17 August 2009 (UTC)