-->
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.  [ 4 posts ] 
Author Message
 Post subject: Best way to store Arrays of objects?
PostPosted: Mon Jan 19, 2004 2:40 pm 
Beginner
Beginner

Joined: Mon Dec 01, 2003 8:48 pm
Posts: 47
Location: Texas, United States
Should I just loop through the array and call save() for each object?

public void save(SomeArray[] array) {
try {
Session session = sessionFactory.openSession();
for (int i = 0; i < array.length; i++) {
session.save(array[i]);
}
} catch (HibernateException ex) {
//handle exception
}
}

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 2:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If your array is not in fact an association from another persistent class, yes


Top
 Profile  
 
 Post subject: Thanks, one more thing...
PostPosted: Mon Jan 19, 2004 2:44 pm 
Beginner
Beginner

Joined: Mon Dec 01, 2003 8:48 pm
Posts: 47
Location: Texas, United States
Will setting the hibernate.jdbc.batch_size help with my performance in this method?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 2:51 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Maybe. Try it


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