Sambolino wrote:
...if you want composite PK...
@Entity
@IdClass(CategoryTranslationId.class)
public class CategoryTranslation
@Id
@Column(insertable=false, updatable=false)
private Long category_id;
@Id
@Column(insertable=false, updatable=false)
private Long translation_id;
@ManyToOne
@JoinColumn(name="category_id", insertable=false, updatable=false)
private Category category;
@ManyToOne
@JoinColumn(name="translation_id", insertable=false, updatable=false)
private Translation translation;
//...
you will need to implement idclass, but that's trivial
maybe it's smarter tho to add semantics-free PK
Thank you very much, it is pretty obvious now that I was stuck in the old JDBC way of thinking.... I do of course need a CategoryTranslation class. And adding a semantics free PK is no problem. Thank you for setting my thoughts straight ;)