Presumably, User and Computer have fields named id?  You might want to try a 
different JoinColumn like user_id or just leave it out and see what hibernate's 
magic makes for you.

-D
On May 27, 2010, at 6:34 AM, Kissue Kissue wrote:

> Hi Gurus,
> 
> I am having problem with mapping one-to-one relationship in appfuse.
> 
> Basically i have to objects, User and Computer.
> 
> In User, i have the relationship mapped as follows:
> 
> public class User{
> 
>    @OneToOne(fetch=FetchType.LAZY)
>     @JoinColumn(name="id")
>     public Computer getComputer() {
>         return computer;
>     }
> }
> 
> in Computer I have it mapped like so:
> 
> public class Computer{
> 
>  @OneToOne(mappedBy="computer")
>     public User getUser() {
>         return user;
>     }
> }
> 
> When the schema is created i expect to see foreign keys created but no 
> foreign key is created either on user table or computer table. Any ideas what 
> i may be doing wrong?
> 
> Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to