Re: delete from ... where ... in (...)

From: Borut Bolčina (borut.bolcin..mail.com)
Date: Fri May 30 2008 - 09:53:20 EDT

  • Next message: Andrus Adamchik: "Re: delete from ... where ... in (...)"

    Hi,

    EJBQLQuery delete = new EJBQLQuery("delete from Artist a where a.id in (1,
    > 2, 3)");

    this looks more promising. It would be better this way (IMHO):

    context = // assume this exists
    List<Integer> myArtistList = // assume this exists
    EJBQLQuery delete = new EJBQLQuery("delete from Artist a where a.id in
    :myArtistList");
    delete.setParameter("myArtistList", myArtistList);
    context.performNonSelectingQuery(deleteQuery);

    Is this possible? Or, would it be?

    Thanks,
    Borut

    2008/5/30 Andrus Adamchik <andrus@objectstyle.org>:

    > See my other reply - there is actually an EJBQL delete.
    >
    >
    >
    > On May 30, 2008, at 4:27 PM, Borut Bolčina wrote:
    >
    > Hi,
    >>
    >> what is the C3M4 prefered way of doing this SQL equivalent: DELETE FROM
    >> Artist WHERE Oid IN (1,4,8,9);
    >>
    >> Thanks,
    >> Borut
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri May 30 2008 - 09:53:51 EDT