Saturday, June 13, 2009

ManyToOne mapping in case of primary key composed of foreign key

For a primary key composed of a foreign key from a ManyToOne in JPA 1.0 you need to map the foreign key field twice. With a basic @Id mapping and with the @ManyToOne, the @ManyToOne should be set read-only (insertable, updatable=false, or use @PrimaryKeyJoinColumn)

No comments:

Post a Comment