This content has been marked as final.
Show 2 replies
-
1. Re: 4.0.4.GA - @javax.persistence.OneToOne(mappedBy) with PK
cjc Jun 3, 2006 10:22 AM (in response to fileset)Hi,
I have a similar problem and as fix arround I used a @OneToMany and just use the first Entry of the List. This is very dirty and i down't know how to fix.
If anybody has a simple working *.jar with @OneToOne pleace post a link!! -
2. Re: 4.0.4.GA - @javax.persistence.OneToOne(mappedBy) with PK
fileset Jun 8, 2006 3:32 AM (in response to fileset)Found a workaround, or the required solution:
use the @PrimaryKeyJoinColumn annotation
on both sides of the relation.public class EbMaster { ... private EbPKJoinDetail myPkDetail; @OneToOne(optional=true,fetch=FetchType.LAZY) @PrimaryKeyJoinColumn(name="id",referencedColumnName="id") public EbPKJoinDetail getMyPkDetail() { return myPkDetail; } } public class EbPKJoinDetail { ... private EbMaster myMaster; @OneToOne(optional=false,fetch=FetchType.LAZY) @PrimaryKeyJoinColumn(name="id",referencedColumnName="id") public EbMaster getMyMaster() { return myMaster; } }