-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to persisit
PostPosted: Fri May 06, 2005 6:36 am 
Newbie

Joined: Fri May 06, 2005 6:21 am
Posts: 2
SampleDTO
{
String,
int
Date
Collection AnotherDTO
}

AnotherDTO
{
String,
int
Date
Collection YetAnotherDTO;
}

Now, Im looking for a method in Hibernate which can take in a Collection of SampleDTO objects & persist recursively all its children.

Im using Hib 2.1 & Ive heard this is only possible in Hibernate 3.0

Pl advise. if this possible?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 06, 2005 6:40 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Map you classes using cascade="all" in the one-to-many direction.
Iterate over your SampleDTO and save each one. The save will then cascade.

This is possible with Hib2 and 3


Top
 Profile  
 
 Post subject: persisting Collection Objects
PostPosted: Fri May 06, 2005 7:28 am 
Newbie

Joined: Fri May 06, 2005 6:21 am
Posts: 2
Using cascade all wont work fine I guess, atleast its a performance hit if you loop on the Collection & call a "save" for every object. (assuming its an SQL query execute behing the hibernate call)

Imagine 1000 records & this method can go for a major toss!

Thats precisely the reason why we are currently using stored procedures which takes in an ORacle ARRAY Type with STRUCT types built in (the types converted in DAO layer)

I had the impression that Hibernate is smart enuff to do a recursive save, but things look otherwise here :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.