-->
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: How to persist more than one object at once?
PostPosted: Thu Dec 14, 2006 7:48 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
hello!
is there a possibility to persist more objects at once eg.
session.saveAll(Collection c);?
or do i have to iterate throgh the collection?

Iterator iter = c. iterator();
while (iter.hasNext())
session.save(iter.next());

thx

edit: Hibernate 3.1.3


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 8:06 am 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
Probably you have considered that ... but just to be sure :

if these objects are associated between them or to another object, you can use the "persistence by reachability" with the cascade options


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 8:34 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
thx, yes i know. but i want to persist objects, which are not referenced between each other. eg. i am creating a 10 users an want to persists them. with jdo i could say pm.persistAll/deleteAll(Collection c).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 9:09 am 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
I'm afraid that there is not a direct solution :

from the documentation (http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html, section 10.5) :

Quote:
(...) Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate may however provide special mass operation functions. See Chapter 13, Batch processing for some possible batch operation tricks.


referenced chapter (http://www.hibernate.org/hib_docs/v3/reference/en/html/batch.html) explains how to prevent out of memory exceptions and increase performance when the set of inserted objects is large enough.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 20, 2006 10:12 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
dominicus wrote:
I'm afraid that there is not a direct solution :

from the documentation (http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html, section 10.5) :

Quote:
(...) Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate may however provide special mass operation functions. See Chapter 13, Batch processing for some possible batch operation tricks.


referenced chapter (http://www.hibernate.org/hib_docs/v3/reference/en/html/batch.html) explains how to prevent out of memory exceptions and increase performance when the set of inserted objects is large enough.


thx a lot. then i will implement it myself.


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.