-->
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: How to: Inverse OneToOne-mapping
PostPosted: Fri Oct 30, 2009 6:09 pm 
Newbie

Joined: Fri Oct 30, 2009 5:49 pm
Posts: 1
I am desperately trying to solve the following problem:

I have to entities A and B with an OneToOne-relation ship from A to B:

Code:
@Entity
public class A {
...
@OneToOne(...)
private B b;
}

@Entity
public class A {
}


Hibernate will now generate a foreign-key from A (column b_id) to B (referencing the id of B).

Is there anyway to force Hibernate to inverse this relationship (i.e. add column a_id to B). This is (of course) the default behaviour for 1-m-relationships, and I know that due to performance reasons you usually don't use this direction for OneToOne-mappings, but in my case I need the reference the other way around. Is there anyway to solve this problem?

THX VERY MUCH


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.