Hi,
it's my first day using hibernate and i got the first problem. I hope to find some help here. I've got a class Belegung
Code:
@Entity
@Table(name="BELEGUNG")
public class Belegung implements Serializable {
...
@EmbeddedId private BelegungId belegungId;
...
}
which defines and EmbeddedId called belegungId. The id object contains two other objects also entities. But i just need the primary keys of these entities otherwise java throws a mapping exception. Have anybody a idea how can solve these problem with a jpa annotaion for my fields. I've tried this:
Code:
@Embeddable
public class BelegungId implements Serializable {
/* The entity Veranstaltung */
@JoinColumn(name="VERNR", referencedColumnName="VERNR")
private Veranstaltung veranstaltung;
/* The entity Student */
@JoinColumn(name="MATRNR", referencedColumnName="MATRNR")
private Student student;
But it didn't work. It seems to me that i got the whole entities instead of the attributes.
I hope somebody can help me.
Thanks a lot.