-->
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.  [ 3 posts ] 
Author Message
 Post subject: how Can I do batch delete in hibernate
PostPosted: Wed Aug 18, 2004 11:38 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 4:32 am
Posts: 31
I want to finish this in hibernate:
"delete from department where deptId in('d001','d002','d002')"

I do it like this now:
Code:
String deptIds = {'d001','d002','d002'};
for(int i=0;i<deptIds.length;i++){
  Object obj = session.load(DepartmentPO.class,deptIds[i]);
  session.delete(obj);
}


and this will generate 3 select sql commands and 3 delete sql commands,
I don't think this is a good to do it ,Who can give me some suggestion?

Best Wishes.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 1:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
for massive update or delete, do it in jdbc

with orm you'll generally have one select/update or one select/delete

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Last edited by anthony on Thu Aug 19, 2004 2:49 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2004 2:42 am 
Beginner
Beginner

Joined: Thu Jul 22, 2004 4:32 am
Posts: 31
thank you


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