-->
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: Direct XML mapping and inheritance.
PostPosted: Thu Jun 19, 2008 9:03 am 
Newbie

Joined: Wed Jun 18, 2008 8:41 am
Posts: 8
Hi,

I have a direct-to-XML table representation where I've got a one-to-many representation between two tables that share a lot of the same columns. I want the behaviour to be such that my object representation of the children inherit values from the parent tables ONLY IF the child value for the matching column is NULL. Currently, I am doing XML post-processing and populating the element fields manually by inspecting to see if they are empty first. But wondered if there is a way to do this with Hibernate.

Here is the mapping:

Code:
<class
  entity-name="parent"
  table="parent">
 
  <id name="key1" type="int"/>

  <set name="children" inverse="true">
    <key column="key1" not-null="true"/>
   <one-to-many entity-name="child" embed-xml="true"/>
  </set>
  ...
</class>

<class
  entity-name="child"
  table="child">
 
  <composite-id>
    <key-property name="key1" type="int"/>
   <key-property name="key2" type="int"/>
  </composite-id>

  ...
</class>


I'm wondering if I could somehow make use of <subclass/> functionality ... I played with this before, but ran into some difficulties.

Suggestions are appreciated. :)


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.