-->
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: Saving a list of objects
PostPosted: Tue Dec 11, 2007 8:59 am 
Newbie

Joined: Tue Dec 11, 2007 8:54 am
Posts: 4
when i do session.save(object)
its saves the object to the db
what is the easiest way to save a list of the same object.
If i do a for loop and save each object i get multiple sql inserts, which i dont want.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 12, 2007 9:40 am 
Newbie

Joined: Mon Oct 29, 2007 2:33 pm
Posts: 16
Location: Cambridge, MA
It is normal to get a sequence of inserts to add multiple rows to a table. SQL doesn't have a multiple-row-insert construct. The only shortcut to multiple inserts is a database "load" command, which ofen requires the whole database (or the set of related tables) to be put in a special standalone state. It's only meant for an initial load.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 12, 2007 10:39 am 
Beginner
Beginner

Joined: Fri May 18, 2007 10:28 am
Posts: 48
Location: Madison, WI
Take a look @ this hibernate tutorial.

http://www.hibernate.org/hib_docs/refer ... batch.html

_________________
Please rate if it helped


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.