I'll reply to myself .... I've used NHProfiler (really good tool : ) ) and I can see the DELETE are batched according to the value in <property name="adonet.batch_size">5</property>
I've created the JIRA request for the IN thing. Thanks to all ! On 7 avr, 09:40, graphicsxp <[email protected]> wrote: > Ok, so it's not possible to do what I want, that's all I wanted to > know. I will add the JIRA request. > > Regarding the batch thing, I was told I can't do it when doing an > INSERT because my table has a identity field. Is it true for DELETE > as well ? > > On 6 avr, 22:13, Fabio Maulo <[email protected]> wrote: > > > If what you are looking for is only one round trip you can obtain the same > > result configuring<property name="adonet.batch_size">100</property> > > > If you want exactly > > DELETE FROM TABLE_A WHERE CHILDREN_ID IN (1, 2, 3) > > > you should add a Improvement request in our JIRA. > > > 2009/4/6 graphicsxp <[email protected]> > > > > Fabio> We've cross-posted, I only saw your question now. > > > > So that we are all on the same page : > > > > class A{ > > > > IList<B> myChildren; > > > > } > > > > class B { > > > > } > > > > int Id = 5; > > > A myEntity = session.getById<A> (Id); > > > > A.myChildren.clear(); > > > > session.SaveOrUpdate(A); > > > > If there were 3 children in the collections, the sql generated is: > > > > DELETE FROM TABLE_A WHERE CHILDREN_ID = 1 > > > DELETE FROM TABLE_A WHERE CHILDREN_ID = 2 > > > DELETE FROM TABLE_A WHERE CHILDREN_ID = 3 > > > > When what I would like NH to do is : > > > > DELETE FROM TABLE_A WHERE CHILDREN_ID IN (1, 2, 3) > > > > Hope it is clear to everyone now :) > > > > Please someone, tell me NH can do that :) > > > > On 6 avr, 21:11, Graham Bunce <[email protected]> wrote: > > > > I think you have the same problem I had.... NH will not (as I > > > > understand it) generate a single DELETE FROM entity WHERE foreignkey = > > > > X. From my tests it will work out the keys of the child table and > > > > delete them all one-by-one, i.e. DELETE FROM entity WHERE primarykey = > > > > Y, where NH has already got the primary keys into its cache. > > > > > The documentation is very misleading IMO about this. > > > > > On-delete-cascade does not mean NH will do the above, it means NH will > > > > not do a delete at all and leave it up to the database (RI cascade > > > > delete or a trigger). > > > > > Therefore if you cannot change your DB then you are stuck, which does > > > > surprise me TBH as there are plenty of brownfield situations where you > > > > cannot change the DB. > > > > > I'm happy for a NH expert to come along and say "no, you're an idiot, > > > > this is the mapping you need" (and I wish they would) but I've raised > > > > this query myself on these forums a while ago and this was the > > > > response I eventually managed to work out from some of the very > > > > cryptic responses I recieved. > > > > > If I'm wrong, then please let me know. > > > -- > > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
