I have a problem concerning hibernate and the mapping to an embeddedId.
The EntityB has a composite key. I want to add a reference (ManyToOne) from EntityA to one of the primary keys of EntityB. I tried several suggestions but nothing worked out.
@Entity
public class EntityA {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private EntityB enB;
--- plus constructor/getter and setter for hibernate
}
EntityB looks like this
@Entity
public class EntityB {
@EmbeddedId
private CompositeKey compKey;
--- some more attributes of the class and the generic methods for hibernate
}
@Embeddable
class CompositePK {
private int id;
private int path;
private int time;
...
}
I want to reference from the EntityA to the "id" of EntityB. I hope I explained it understandable. Thanks!