-->
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: Batch inserts Problem (Hibernate 3.0)
PostPosted: Fri Apr 29, 2005 5:46 am 
Newbie

Joined: Fri May 21, 2004 2:59 am
Posts: 12
Hi All,

I am inserting a batch of records into the table. The first record is inserting properly and from the second record ..it is giving "ignoring persistent instance DEBUG - object already associated with session:"

Here i am giving the sample code what i have written.

session = getSession();
transaction = session.beginTransaction();

while (iterator.hasNext( )) {
abcVO = masterVO.getAbcVO();

session.save(abcVO);

if ( i % 20 == 0 ) { //20, same as the JDBC batch size
//flush a batch of inserts and release memory:
session.flush();
session.clear();
}
i = i + 1;
}
transaction.commit();


I have configured the hibernate.cfg.xml file as follows:

<property name="connection.username">username</property>
<property name="connection.url">jdbc:oracle:thin:@HostName:1521</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.jdbc.batch_size">20</property>
<property name="hibernate.cache.use_second_level_cache">false</property>


Regards,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 29, 2005 8:19 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:30 am
Posts: 21
Location: Brussels
Are you sure abcVO isn't pointing to the same object instance in each iteration?


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.