-->
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: Bidirectional one-to-one association from subclass to parent
PostPosted: Thu Feb 14, 2008 11:23 am 
Newbie

Joined: Thu Feb 14, 2008 11:05 am
Posts: 1
Hibernate version: 3.2.4.sp1

Name and version of the database you are using: Mysql 5.0.40 with InnoDB

I am having problems with bidirectional one-to-one association within a table per hierarchy mapping.

Basically I have a parent class A that has two different subclasses B and C. A has a many to one association to class B with the following mapping:
Code:
<many-to-one name="TargetB" class="B" column="TargetB_id" unique="true"/>


This association works perfectly, but problems arise when I try to make the association bidirectional. The subclass mapping looks like this:
Code:
<subclass name="B" discriminator-value="B">
<one-to-one name="owner" class="A" property-ref="TargetB"/>
</subclass>


When running the program, hibernate does not raise any exceptions and there are no log messages indicating problems with the mapping. Instead, the value of property owner in class B is always null, even if there are entities of type A that are associated to it.

Can anybody guide me to the correct direction?


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.