-->
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: <any> with <one-to-one> problem
PostPosted: Mon Mar 24, 2008 4:29 pm 
Beginner
Beginner

Joined: Fri Aug 10, 2007 3:34 am
Posts: 44
i have a class ContactData with property Parent which can be of types:
Location or Person. For this i used a <any> mapping.
The Location and Person classes have a reference to ContactData
but as a one-to-one relation. I've use a <any> mapping in
ContactData and a <one-to-one> in each of the Location and
Person classes. The insert is OK but when i load a Person it
gets a ContactData that has the Parent property of type Location

is here a way to solve this?


in ContactData mapping:
<any name="Parent" meta-type="string" id-type="Int32">
<meta-value class="Location" value="LOC"/>
<meta-value class="Person" value="P"/>
<column name="ParentType" not-null="true"/>
<column name="ParentId" not-null="true"/>
</any>

in Location and Person
<one-to-one name="Contact" class="ContactData cascade="all" lazy="false"/>


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.