-->
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.  [ 2 posts ] 
Author Message
 Post subject: Performance of Mass Creation (10'000 INSERT)
PostPosted: Thu Feb 17, 2005 7:38 am 
Beginner
Beginner

Joined: Wed May 12, 2004 4:27 am
Posts: 21
Location: Montreux (CH)
Hello,

I've got a BIG problem :-)

I need to export 10,000-100'000 objects into my database.
I use Hibernate everywhere in my application and I would like to keep using it.
DB is SQL Server 2000 with nvarchar...

I do something like that :

for (Iterator iter ...... ) {
MyObject obj = new MyObject();
obj.setXXX(.....)
...
hibernate.save(obj);
if (count++ % 20 = 0) {
hibernate.flush();
hibernate.clear();
}
}

I've also tried to clear and flush.. only at the end..

Well... to insert 15'000 articles, it takes 2 minutes !

When I try this :

PreparedStatement ps = hibernate.connection().createPreparedStatement("INSERT INTO ..... VALUES (?,?,?)");
for (Iterator iter ...... ) {
MyObject obj = new MyObject();
obj.setXXX(.....)
...

ps.set(1, obj.getXXX....);
....
ps.execute();
}


it takes 15-20 seconds....


Is there a way that Hibernate uses its preparedstatement ??

I've tested with transactions....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 17, 2005 10:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
First see FAQ (last question).
http://hibernate.org/117.html


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