Delete a list in one shot

Hi,
I'm using Hibernate 3 with Oracle 10, and in my next query I delete a list of objects one by one; I was wondering if it's possible to optimize my delete method so I delete the complete set of objects in one shot instead iterating my list of retrieved objects.
Please consider that I'm requested to maintain an ORM style so writing a delete sentence is not an option.
Thanks a lot.
public void deleteClientOrder(final Address userAddress, final ClientID clientID) throws HibernateException {
HibernateCommand command = new HibernateCommand() {
public Object execute(Session hibernateSession) {
List<String> list = hibernateSession
.createCriteria(ClientOrder.class)
.add(eq("userAddress", userAddress))
.add(eq("clientID", clientID))
.setProjection(Projections.projectionList()
.add(Projections.property("id")))
.setCacheable(false)
.list();
for (String persistenID : list) {
ClientOrder tmp = (ClientOrder) hibernateSession.get(ClientOrder.class, persistenID);
if (tmp != null) {
hibernateSession.delete(tmp);
return null;
}

TopLink provides bulk delete operations.
JPA:
em.createQuery("DELETE FROM Employee WHERE firstName LIKE 'D%' AND address = :ADDRESS")
     .setParameter("ADDRESS", address)
     .executeUpdate();Native:
DeleteAllQuery query = new DeleteAllQuery(Employee.class);
ExpressionBuilder eb = query.getExpressionBuilder();
Expression fnExp = eb.get("firstName").like("D%");
Expression aExp = eb.get("address").equal(address);
query.setSelectionCriteria(fnExp.and(aExp));
uow.executeQuery(query);Doug

Similar Messages

  • How to delete multiple InfoObjects in one shot?

    Hello Experts,
    Is there any way to delete a bunch of InfoObjects / ODSs in one shot?
    Scenarios:
    1. We have thousands of custom IO which are no use any more and we want to get rid of these IO to save space. How to do it?
    2. We have thousands of custom ODS too which need to be deleted. We want to delete ODS which are not used any more and also the InfoObjects in ODSs which are not used by any other ODS or any other places. How do I do that in one shot?
    BTW way our BW is 3.1 version but will be upgrading soon.
    Regards,
    Mau

    Hi,
    goto RSD1 and mark the option "Free Selection of IObjs"
    Hit the Maintain button In the next screen Select your IObjs to be maintained (at this stage the system will lock the selected IObj !!)
    In the next screen mark the IObjs you want to delete
    Then Menu Characteristics / Delete (shift + F2)
    this should work.
    Alternatively, try developping an ABAP based on function module RSDG_IOBJ_MULTI_DELETE.
    hope this helps...
    Olviier.

  • How do i deleting many backup on one shot ? (Bulk deleting backup)

    Hello,
    I looking for any method for removing old backup on one shot.
    Anyone already done it ?
    Thanks
    Guy

    In the vsphere web client you can go to the restore tab and select multiple backups to delete within each client.  So if you have multiple points in time for one client to delete its quick.  If you want to delete multiple clients backups I'm not aware of a quick way.
    You could script the delete using mccli but it would require some knowledge about how it works that is not documented by vmware and would not be for the faint of heart.  I highly doubt mccli is fully supported by vmware so use at your own risk.  Even if it was supported it would probably still be quicker to delete each backup in the the VDP webclient.  Thinking way outside the box one possible work around would be to create a new VDP appliance and replicate the backups you want to save to it then delete the old appliance.  Although you would probably have to recreate all your backup jobs on the new appliance so I doubt its what your looking for.

  • NEW DEBUGGER: How to delete selected rows is one shot

    Hi Specialists,
    I have a small question. While debugging a program I have an internal table having 300 records .
    Now I wish to delete 290 records during debugger session in one shot instead of choosing 1 by one.
    Is there way I can select & do .
    I searched but could not locate "SELECT ALL " button.
    -Abhinav.

    Hello here is one example
    please follow this formula.
    here selection is in terms of 
    itab-mblnr = itab1-lfbnr.
    itab-zeile = itab1-lfpos . "
    and system delete selected row of itab using
    "DELETE TABLE itab FROM itab."
    IF sy-subrc = 0.
      itab-mblnr = itab1-lfbnr.
    itab-zeile = itab1-lfpos .
      DELETE TABLE itab FROM itab.
      endif.
    Edited by: riten patel on Feb 12, 2010 11:33 AM

  • How to delete recurring objects in one shot

    I have a logo that appears on 50+ pages that now needs to be removed. I was hoping I could choose it in Links and hit a delete button and have all of them gone in one fell swoop. But there's no delete option there. Can this be done at all, and how?
    Thanks!

    Is the logo on a master page? If so, it would be a one time delete.
    Here is the kludge suggestion of the day... create an Illustrator file with nothing in it, save. In Indesign, relink to the blank .ai file with "Relink All Instances of" selected. This is of course you don't mind that all the original frames remain, but containing a blank graphic file.

  • Delete all rows on VO at one shot

    Hi,
    I have a VO based on an EO. Now once I get a VO I could see that there are 2 methods:
    1. removeCurrentRow()
    2. remove()
    removeCurrentRow() would delete the current row and also the related row of the table associated with the EO.
    Is remove() the methods to remove all the rows linked to the VO or is there any other method. what does remove() do if not deleting the rows at one shot.
    Thanks,
    Kalyan.

    <p>
    Use this method in your Application Module:
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">public void removeAllRows(){</font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">   ViewObject vo = getYourViewObject();</font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">   vo.executeQuery();</font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">   while(vo.hasNext()){</font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">       Row r = vo.next();</font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">       r.remove();
    </font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">   } </font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">   getDBTransaction().commit;
    </font></strong>
    </p>
    <p>
    <strong><font face="courier new,courier" size="2">}</font></strong>
    </p>
    <p>
    Kuba
    </p>

  • How to delete THE WHOLE Reading List of Safari iOS 8 in one shot?

    I know how to delete individual items one by one by sliding them to the left, I know how to clear their cache in Settings and I know how to clear Safari's history but  nothing clears the whole Reading List in one stroke.
    How do you do?
    Thank you very much in advance for your answer.

    Please read this book.
    http://www.amazon.com/s?ie=UTF8&rh=i%3Astripbooks%2Cp_27%3AMatthias%20Zierke&field-author=Matthias%20Zierke&page=1
    Rg,
    Harshit

  • Deletion of multiple sale orders at one shot

    Hi Friends,
    Can anyone tell me how to delete multiple sale orders at one shot?
    Friendly
    Rama Rao

    Hi
    Try doing it through LSMW, I used LSMW for deleting deliveries in mass and it worked
    Anurag

  • Deletion in one shot.

    Hi Guys,
    i hava requirement after a condtion check ...if it becomes true ..i have to delete all the rows from that table.
    can any body suggest me the statement which do this..
    i got syntax from documentation like this.
    To DELETE all the lines..
    where condition must use a itab which is empty..
    then u r able to delete all the lines in one shot..
    But i need a simple soltuion.
    any body help me plz.
    i appreciate ur help in advance.

    strange....
    read this...
    DELETE dbtab - cond
    Syntax
    ... WHERE sql_cond.
    Effect
    The WHERE addition uses a logical expression sql_cond to specify which rows in the database table are deleted. The same applies to the logical expression sql_cond as for the WHERE condition of the SELECT statement. If there is no row in the database that satisfies the WHERE condition, no row is deleted and sy-subrc is set to 4. <b>If no WHERE condition is specified, all rows are deleted.</b>
    Note
    As of Release 6.10, specifying the WHERE condition is optional. Prior to Release 6.10, you had to specify the WHERE condition in this variant of the DELETE statement and you could not use dynamic logical expressions.

  • Can I delete the contacts list in one go

    Can I delete the contacts list in one go - CJ

    Are you syncing via iTunes? Do you want to erase everything on the phone, or just the contacts? If syncing via iTunes, just have it sync to an empty contact list is one way.

  • I want to delete a group on my iChat list, but it doesn't go away when I right click and delete it. No ones in the group and I tried the plus button on the bottom left of the list and I can't find "edit groups"

    I want to delete a group on my iChat list, but it doesn't go away when I right click and delete it. No ones in the group and I tried the plus button on the bottom left of the list and I can't find "edit groups"

    WordPress is in a class of it's own.  It began it's open source life as a blogging system but it has evolved into a powerful, feature-rich CMS (content management system).  In short, if you elect to use WordPress on your domain, you might just as well use it for your entire web site.
    To work with WordPress, you will need a firm understanding of HTML, CSS and how PHP includes work.
    WP requires you to set-up a dynamic work environment (see links below)
    Find a WP Theme you like that won't require much customizing on your part.
    Related Links:
    http://wordpress.org/
    Get one of the following testing servers for your OS and follow the installation instructions.
    WAMP for Windows
    http://www.wampserver.com/en/
    XAMPP for Windows
    http://www.apachefriends.org/en/xampp-windows.html
    XAMPP for Mac
    http://www.apachefriends.org/en/xampp-macosx.html
    MAMP for Mac
    http://www.mamp.info/en/downloads/index.html
    Setting up a PHP development environment for Dreamweaver
    http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_05.html
    Creating a WordPress Theme in DW
    http://www.adobe.com/devnet/dreamweaver/articles/creating_wordpress_theme_with_dreamweaver _pt1.html
    Best of luck,
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web-design.blogspot.com/

  • How to delete all PO of 1 series in one shot ?

    Dear All,
    Please guide in deleting mass PO in 1 shot.
    Regards,
    Shreya

    All capital inventory till FY-2008-09 was transferred to revenue inventory by movemnt typr 411-Q in MB1B.All the codes those were transferrd are now appearing in MBBS but with zero value. However these codes are appearing in MB5L with value under GL 132006 (for capital items) and having value of 1.08 crores (0.94 crore for imported items and 0.14 crore for revenue items). The GL for all these codes neds to be changed to 132000 (revenue inventory GL) so that in MB5L also these items appear as revenue items.As of today GL of all the codes appearing under GL 132006 are to be changed to 132000 except code 496700086.
    now, changes are reflected in report MBBS but not showing correct information in MB5L report..
    Please guide what is the difference between MBBS and MB5L report.
    Regards
    SHreya

  • How to delete Multiple Artists in one action?

    Hi,
    I want to do a big clean up on an iTunes library with over 4000 albums.
    How can I delete multiple Artists in one action?
    It looks like I can only delete 1 Artist at a time, and then this action shoots me to the top of the list.  Which is a pain then having to scroll back down through such a huge list to then delete the others one at a time... each time being shot back to the top of the list.
    For example I have the following artists;
    The Alarm 01 – 1 song
    The Alarm 02 – 1 song
    The Alarm 03 – 1 song
    The Alarm 04 – 1 song
    The Alarm 05 – 1 song
    The Alarm 06 – 1 song
    And I want to delete them all in 1 action.
    Can this be done?  How best to do it?
    Thanks in advance,
    Dave

    You can't delete "artists" - just songs (or songs grouped into albums).  When iTunes displays the library or a playlist in Artists view it is doing so using the metadata values set in the relevant songs.  If you're looking at this view:
    then your selections in the left pane - the artists list - is filtering what you see on the right.  When you select Delete via the keyboard or via a right-click operation, you are initiating an operation to delete the songs by that artist.  To delete songs by more than one artist in a single operation you'll need to select and delete in Albums view:
    or in Songs view:
    where you can also use the Column Browser to filter songs by multiple artists:

  • Having trouble deleteing call list

    Can someone please help me out if possible. Is there a way to delete the recent call list all in one shot instead of doing it one by one. I have the 8330 curve with verizon. Thank you!
    Solved!
    Go to Solution.

    highlight the first entry and hold down the caps key (aA) and scroll down until you have highlighted the list and select delete.
    I hope this helps.

  • How to copying all pages at one shot?

    Does anybody know of a way of copying all pages at one shot, under a tabset in an application in a workspace to another application in the same workspace instead of doing it page by page?

    There is no Select All option, but you can do it a little faster than opening each email and tapping the Trash icon. In the top rightcorner of the list of email is an edit button. Tap Edit.
    You can then tap each email in the list to select it for deleting and then tap the Delete button at the bottom of the list.
    These screenshots are from my iPad, but it works the same on my iPhone.

Maybe you are looking for