We are not really mapping associations so the cascade strategy is not very helpful to me in this particular case. The above discussed query seems to eb workign for me.
On Dec 14, 3:46 pm, Jason Meckley <[email protected]> wrote: > like Diego said, there isn't really a "best" way. How you go about > deleting depends on your mappings. the cascade strategy you use will > greatly influence how you delete data. I have heard of some systems > that do not require the use of Save or Delete. All inserts and deletes > are managed by Adding or Removing an object from a collection. > > On Dec 14, 4:13 pm, Diego Mijelshon <[email protected]> wrote: > > > > > 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.- Hide quoted text - > > - Show quoted text - -- 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.
