-->
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.  [ 2 posts ] 
Author Message
 Post subject: cascading inserts from child to parent.. is it possible?
PostPosted: Thu Apr 28, 2005 4:47 pm 
Newbie

Joined: Thu Apr 28, 2005 7:22 am
Posts: 3
I have a case where I have a relational model which I want to load with data in an xml file using the new dom4j entity mode features in hibernate 3. Part of the system models Document and Author entities, a many-to-one relationship, ie an Author has many documents.

The xml file looks like

Code:
<document>
    <title>the title</title>
    <author>joe.bloggs@acme.com</author>
</document>


both document and author tables use db2 identity columns as primary, surrogate keys. Author email is a natural key in the table. Can I set up a mapping for the document entity that will...

map to the correct author entry if it already exists and if it doesn't create it. So you see I want to cascade upwards to what is normally seen as the parent. This might make no sense in which case I am probably not explaining it well enough. Any help would be appreciated.


Top
 Profile  
 
 Post subject: Re: cascading inserts from child to parent.. is it possible?
PostPosted: Thu Apr 28, 2005 4:51 pm 
Newbie

Joined: Thu Apr 28, 2005 7:22 am
Posts: 3
seanlaval wrote:
I have a case where I have a relational model which I want to load with data in an xml file using the new dom4j entity mode features in hibernate 3. Part of the system models Document and Author entities, a many-to-one relationship, ie an Author has many documents.

The xml file looks like

Code:
<document>
    <title>the title</title>
    <author>joe.bloggs@acme.com</author>
</document>


both document and author tables use db2 identity columns as primary, surrogate keys. Author email is a natural key in the table. Can I set up a mapping for the document entity that will...

map to the correct author entry if it already exists and if it doesn't create it. So you see I want to cascade upwards to what is normally seen as the parent. This might make no sense in which case I am probably not explaining it well enough. Any help would be appreciated.

It seems any solution centres around the many-to-one element or the join element in the hibernate mapping but I am unsure as to which one to use.



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.