Hi Michael, The problem could be in domain model/mapping definition. The model follows a "duplicate mapping" approach. Let me explain what I mean by "duplicate mapping" in the context of your application.
public class Seasontime { @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.MERGE) @JoinColumn(name="hotel_idhotel", columnDefinition="INT") private Hotel hotel; @Id @Column(name="hotel_idhotel", columnDefinition="INT") private int hotelIdhotel; Now in this model, both fields "Hotel hotel" and "int hotelIdhotel" refer to the same "logical" thing i.e. a Hotel object, but in two different ways. A JPA runtime, however, has little clue that they mean the same thing. To make JPA understand this "implicit" sameness of these two fields, there are two possibilities a) annotate "int hotelIdhotel" with @ForeignKey(implicit=true) (see @ForeignKey documentation for details) b) remove the ""int hotelIdhotel" field altogether. Instead annotate the "Hotel hotel" as @Id. JPA 2.0 supports a object reference as a primary key either as a simple key or part of a compound key. I prefer this approach because it avoids the "duplicate mapping" problem and results into cleaner domain model. Examples of such modeling technique can be found in OpenBooks example distributed with OpenJPA. ----- Pinaki Poddar Chair, Apache OpenJPA Project -- View this message in context: http://openjpa.208410.n2.nabble.com/Diamond-model-and-foreign-keys-tp6819272p6820601.html Sent from the OpenJPA Users mailing list archive at Nabble.com.