I don't know if there's a "best" way, but that query is pretty efficient if
you already have the keys.

The usage is:

session.CreateQuery("delete MyEntity where id in :keys")
.SetParameterList("keys", keys)
.ExecuteUpdate();

   Diego


On Mon, Dec 14, 2009 at 17:53, Waqar Sadiq <[email protected]> wrote:

> Hi All,
>
> I need to delete a bunch of objects that belong to a set.  In my case
> these objects have primay key of type Int64.  I have an array if Int64
> containing the keys of objects that I need to delete.  What would be
> the best way of deleting them.
>
> Ideally, I would be able to write a query like this:  (Ignoring
> transactions)
>
> Int64[] keys = ...;  // an array of primary keys.
>
> string queryStr = "delete from MyEntity wher MyKey in :keys";
> IQuery query = Session.CreateQuery(queryStr);
> query.ExecuteUpdate();
>
> Is this the correct way to delete objects from a set?
>
> Any help would be appreciated.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to