-->
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.  [ 5 posts ] 
Author Message
 Post subject: HowTo: Save list of objects
PostPosted: Thu Jul 12, 2007 10:43 pm 
Newbie

Joined: Thu Jul 12, 2007 9:27 pm
Posts: 11
Hibernate version: 3

If I want to store a List<Person> objects...is there an easier way than:

List<Person> people = getPeople();
for (Person p : people) {
session.save(p);
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 13, 2007 12:07 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Code:
for (Person p: getPeople()) session.save(p);

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Re: HowTo: Save list of objects
PostPosted: Wed May 20, 2009 10:47 am 
Newbie

Joined: Fri Mar 06, 2009 12:58 pm
Posts: 2
Same problem, can hibernate save a list of objects in one shot instead of looping and saving object after object.
Thanks.


Top
 Profile  
 
 Post subject: Re: HowTo: Save list of objects
PostPosted: Wed May 20, 2009 11:55 am 
Newbie

Joined: Fri Feb 08, 2008 2:41 pm
Posts: 18
Hibernate will issue all the statements at once when you flush the session.


Top
 Profile  
 
 Post subject: Re: HowTo: Save list of objects
PostPosted: Fri Feb 05, 2010 1:58 am 
Newbie

Joined: Wed May 20, 2009 9:49 am
Posts: 11
sorry, remove this post, please =(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.