Beginner |
|
Joined: Mon Aug 22, 2005 9:57 pm Posts: 27
|
Hello Dear all
if Using hibernate mapping file
I know how to build bi directional one-to-one for sharing primary key cases.
but how to build bi directional one to one with annotations for sharing primary key cases?
Below is example from book (hibernate annotation docs)
I didnot find bi directional example ,only one way. could any one give me some hints?
@Entity
public class Body {
@Id
public Long getId() { return id; }
@OneToOne(cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
public Heart getHeart() {
return heart;
}
...
}
@Entity
public class Heart {
@Id
public Long getId() { ...}
}
|
|