-->
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: hibernate Criteria delete all
PostPosted: Tue Dec 13, 2011 8:12 pm 
Newbie

Joined: Tue Dec 13, 2011 8:05 pm
Posts: 2
Hi All,

Is their is a better way to implment the delete all by id than following (Preferably in Criteria);

Code:
public void delete(List<Long> ids)
    {
        Session session = getCurrentSession();

        for (Long id : ids)
        {
            User user= (User) session.load(User.Class, id);
            session.delete(user);
        }
    }


When the number of items are more than 10k, system hangs. Just like to know a better way to implmenet it without reloading the obj.

thanks!


Top
 Profile  
 
 Post subject: Re: hibernate Criteria delete all
PostPosted: Thu Dec 27, 2012 4:49 pm 
Newbie

Joined: Thu Jan 26, 2012 11:56 am
Posts: 9
same question here!
im trying to find a delete all method with Criteria.

but as an advice you can use a Store Procedure for masive deletes (its better at performance)

_________________
-------------------------------------------------------------
http://javahelp.redsaltillo.net


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.