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.  [ 1 post ] 
Author Message
 Post subject: Bulk Update in Hibernate 3 using getHibernateTemplate
PostPosted: Fri May 15, 2009 5:47 am 
Newbie

Joined: Thu Jan 15, 2009 9:54 am
Posts: 12
Currently I m using the traditional method of updating my tables.
I m iterating over my list and updating it individually.

here is my code

Iterator iterator = cabRequests.iterator();
CabRequestDTO cabRequest = null;
int requestId = 0;
try {
while( iterator.hasNext() ) {
cabRequest = ( CabRequestDTO ) iterator.next();
Query query = getSession().createQuery( PersistenceConstants.SQL_UPDATE_TABLE_CHANGE_STATUS );
query.setInteger( PersistenceConstants.FIELD_REQUEST_ID, cabRequest.getRequestId().intValue());
query.setEntity( PersistenceConstants.FIELD_DESCRIPTION, cabRequest.getCabRequestStatus() );
query.executeUpdate();
}
}

Is there any other optimized way of doing it using hibernate bulk update method.
I m searching over the net but could not find the code.

Regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.