Hibernate how to use a constant as part of composite foreign reference
I have a master table A with a composite primary key, consisting of two columns. One of these columns is a constant ("THE CONSTANT VALUE" in the code below). This table definition looks like the following: @Entity public class Master { @Id @Column(name = "SIGNIFICANT_KEY") private String realKey; @Id @Column(name = "CONSTANT_KEY") private String constantPartKey; } I have a detail table B, referencing master table A using only one (non-constant) column. I want to implement usual ManyToOne and OneToMany relations between the two tables. Question : How can I handle this situation with Hibernate?