-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: build bidirectional @OneToOne for sharing primary key cases
PostPosted: Mon Feb 19, 2007 12:41 pm 
Beginner
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() { ...}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.