Fabio, I know what the root problem is and I cannot affect it, change it or anything else. Root problem is that we have unobtainable goals, and unreasonable expectations. To give you an idea. We have old system that has horrible relational model that is in many places different from the model that is in a new system. But hey, somebody wants to run both systems at the same time, consistency has to be immediate. So some bright minds came up with and idea, hey let's slap db views for all entities in a new system, intercept all inserts, updates and deletes and fire a triggers that will than synchronize in a real time with old data model. These triggers can trigger other triggers that trigger triggers. Each one of them than has to do Select and join on natural key, because old database did not use surrogate keys, and in some instances all columns in a table are PK (7 columns). Now when one takes in consideration a root object in question here (marketing plan) and again, they want real delete, not a soft delete to delete it needs to execute from NH side 1000's of delete statements and than each delete triggers a trigger .... you get the idea. One delete locks the whole database. So I wanted to intercept the delete and do following, get all ids in the object graph, generate deletes for the whole graph and than suppress deletes generated by NH due to all-delete-orphan, like this. But evict in delete listener does not evict it. NH still generates all deletes, and I get StaleStateException.
2010-09-17 09:01:33,866 [4] DEBUG NHibernate.SQL delete from vw_D_MarketingPlanBaseProductToProduct where BaseProductId in (@p0, @p1, @p2, @p3, @p4);@p0 = 41854, @p1 = 41855, @p2 = 41856, @p3 = 41857, @p4 = 41858 2010-09-17 09:01:33,944 [4] DEBUG NHibernate.SQL delete from vw_D_FullTermFee where FullTermFeeId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 , @p6 , @p7 , @p8 , @p9 , @p10 , @p11 , @p12 , @p13 , @p14 , @p15 , @p16 , @p17 , @p18 , @p19 , @p20 , @p21 , @p22 , @p23 , @p24 , @p25 , @p26 , @p27 , @p28 , @p29);@p0 = 38605, @p1 = 38606, @p2 = 38615, @p3 = 38616, @p4 = 38617, @p5 = 38618, @p6 = 38607, @p7 = 38608, @p8 = 38619, @p9 = 38620, @p10 = 38621, @p11 = 38622, @p12 = 38609, @p13 = 38610, @p14 = 38623, @p15 = 38624, @p16 = 38625, @p17 = 38626, @p18 = 38611, @p19 = 38612, @p20 = 38627, @p21 = 38628, @p22 = 38629, @p23 = 38630, @p24 = 38613, @p25 = 38614, @p26 = 38631, @p27 = 38632, @p28 = 38633, @p29 = 38634 2010-09-17 09:01:34,553 [4] DEBUG NHibernate.SQL delete from vw_D_FullTermRate where FullTermRateId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 , @p6 , @p7 , @p8 , @p9 , @p10 , @p11 , @p12 , @p13 , @p14 , @p15 , @p16 , @p17);@p0 = 257638, @p1 = 257644, @p2 = 257645, @p3 = 257639, @p4 = 257646, @p5 = 257647, @p6 = 257640, @p7 = 257648, @p8 = 257649, @p9 = 257641, @p10 = 257650, @p11 = 257651, @p12 = 257642, @p13 = 257652, @p14 = 257653, @p15 = 257643, @p16 = 257654, @p17 = 257655 2010-09-17 09:01:35,616 [4] DEBUG NHibernate.SQL delete from vw_D_MarketingPlanProduct where MktgPlanProductId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5);@p0 = 53371, @p1 = 53372, @p2 = 53373, @p3 = 53374, @p4 = 53375, @p5 = 53376 2010-09-17 09:01:35,725 [4] DEBUG NHibernate.SQL delete from vw_D_BaseProductCoInsurance where BaseProductCoInsuranceId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5);@p0 = 53086, @p1 = 53087, @p2 = 53088, @p3 = 53083, @p4 = 53084, @p5 = 53085 2010-09-17 09:01:35,944 [4] DEBUG NHibernate.SQL delete from vw_D_BenefitLimit where BenefitLimitId in (@p0 , @p1 , @p2);@p0 = 38110, @p1 = 38111, @p2 = 38112 2010-09-17 09:01:36,022 [4] DEBUG NHibernate.SQL delete vw_D_BenefitDeductibleSupplierType where BaseProductId in (@p0, @p1, @p2, @p3, @p4);@p0 = 41854, @p1 = 41855, @p2 = 41856, @p3 = 41857, @p4 = 41858 2010-09-17 09:01:36,038 [4] DEBUG NHibernate.SQL delete from vw_D_BenefitDeductible where BenefitDeductibleId in (@p0 , @p1 , @p2);@p0 = 22182, @p1 = 22183, @p2 = 22184 2010-09-17 09:01:36,053 [4] DEBUG NHibernate.SQL delete from vw_D_BenefitSpec where BenefitSpecId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 , @p6 , @p7 , @p8 , @p9 , @p10 , @p11 , @p12 , @p13 , @p14);@p0 = 1473169, @p1 = 1473170, @p2 = 1473171, @p3 = 1473172, @p4 = 1473173, @p5 = 1473174, @p6 = 1473175, @p7 = 1473176, @p8 = 1473177, @p9 = 1473178, @p10 = 1473179, @p11 = 1473180, @p12 = 1473181, @p13 = 1473182, @p14 = 1473183 2010-09-17 09:01:36,053 [4] DEBUG NHibernate.SQL delete from vw_D_BenefitStatement where BenefitStatementId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 , @p6 , @p7 , @p8 , @p9 , @p10 , @p11 , @p12 , @p13 , @p14 , @p15 , @p16 , @p17);@p0 = 436960, @p1 = 436961, @p2 = 436962, @p3 = 436963, @p4 = 436964, @p5 = 436965, @p6 = 436966, @p7 = 436967, @p8 = 436968, @p9 = 436969, @p10 = 436970, @p11 = 436971, @p12 = 436972, @p13 = 436973, @p14 = 436974, @p15 = 436975, @p16 = 436976, @p17 = 436977 2010-09-17 09:01:36,069 [4] DEBUG NHibernate.SQL delete from vw_D_ProductBenefit where ProductBenefitId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 , @p6 , @p7 , @p8 , @p9 , @p10 , @p11 , @p12 , @p13 , @p14 , @p15 , @p16 , @p17 , @p18 , @p19 , @p20 , @p21 , @p22 , @p23 , @p24 , @p25 , @p26 , @p27 , @p28 , @p29 , @p30 , @p31 , @p32 , @p33 , @p34 , @p35 , @p36 , @p37 , @p38 , @p39 , @p40 , @p41 , @p42 , @p43 , @p44 , @p45 , @p46 , @p47);@p0 = 1056904, @p1 = 1056905, @p2 = 1056906, @p3 = 1056907, @p4 = 1056908, @p5 = 1056909, @p6 = 1056910, @p7 = 1056911, @p8 = 1056912, @p9 = 1056913, @p10 = 1056914, @p11 = 1056915, @p12 = 1056916, @p13 = 1056917, @p14 = 1056918, @p15 = 1056919, @p16 = 1056920, @p17 = 1056921, @p18 = 1056922, @p19 = 1056923, @p20 = 1056924, @p21 = 1056925, @p22 = 1056926, @p23 = 1056927, @p24 = 1056928, @p25 = 1056929, @p26 = 1056930, @p27 = 1056931, @p28 = 1056932, @p29 = 1056933, @p30 = 1056934, @p31 = 1056935, @p32 = 1056936, @p33 = 1056937, @p34 = 1056938, @p35 = 1056939, @p36 = 1056940, @p37 = 1056941, @p38 = 1056942, @p39 = 1056943, @p40 = 1056944, @p41 = 1056945, @p42 = 1056946, @p43 = 1056947, @p44 = 1056948, @p45 = 1056949, @p46 = 1056950, @p47 = 1056951 2010-09-17 09:01:48,585 [4] DEBUG NHibernate.SQL delete from vw_D_MarketingPlanBaseProduct where BaseProductId in (@p0 , @p1 , @p2 , @p3 , @p4);@p0 = 41854, @p1 = 41855, @p2 = 41856, @p3 = 41857, @p4 = 41858 2010-09-17 09:01:50,023 [4] DEBUG NHibernate.SQL delete from vw_D_CustomMarketingPlanFeature where CustomPlanIndicatorsId in (@p0);@p0 = 84 2010-09-17 09:01:50,023 [4] DEBUG NHibernate.SQL delete from vw_D_MarketingPlanFeature where PlanIndicatorId in (@p0 , @p1 , @p2 , @p3 , @p4 , @p5 , @p6 , @p7 , @p8);@p0 = 73356, @p1 = 73348, @p2 = 73349, @p3 = 73350, @p4 = 73351, @p5 = 73352, @p6 = 73353, @p7 = 73354, @p8 = 73355 2010-09-17 09:01:50,023 [4] DEBUG NHibernate.SQL delete from vw_D_PolicySupplierType where PlcySupplierTypeId in (@p0 , @p1 , @p2);@p0 = 32739, @p1 = 32740, @p2 = 32741 On Sep 20, 2:12 pm, Fabio Maulo <[email protected]> wrote: > describe the root problem instead describe the problem found in what you > think is the solution. > (second chance) > > > > > > On Mon, Sep 20, 2010 at 3:43 PM, epitka <[email protected]> wrote: > > I want to intercept deletion of the "root" of the hierarchy, create > > hql for the whole graph, and than execute deletes for each type of the > > child in the hierarchy ending up with only 14 delete statements with > > IN clause, rather than 1000's of deletes. > > > On Sep 20, 1:39 pm, Jason Dentler <[email protected]> wrote: > > > I still don't have a clear idea of the problem you are trying to solve. > > > > On Mon, Sep 20, 2010 at 1:36 PM, epitka <[email protected]> wrote: > > > > I abandoned IOneShotDeleteHandler, trying now with > > > > DeleteEventListener. If I cannot delete through NH without deadlocking > > > > entire db, and I cannot suppress deletes issued by NH what else is > > > > left. Leave NH and do straight ado.net for the deletes? > > > > > On Sep 20, 1:14 pm, Fabio Maulo <[email protected]> wrote: > > > > > I'm inclined to think that your are still fighting with > > > > > OneShotDeleteHandler. > > > > > > I have looked to that post and I would know if you read the end of > > the > > > > post > > > > > and then understand which is your real problem (I mean the root > > problem > > > > and > > > > > not the problem caused by what you think is the solution). > > > > > This is the conclusion of that post: > > > > > "Make sure you use this solution for one-shot deletes wisely and only > > if > > > > you > > > > > have to. If you can use the CASCADE DELETE foreign key constraints, > > then > > > > by > > > > > all means, this is the preferred option." > > > > > > On Mon, Sep 20, 2010 at 3:02 PM, epitka <[email protected]> > > wrote: > > > > > > Is this supposed to work?. I try evicting items in the DeleteEvent > > > > > > Listener but NH still reports them as in session. > > > > > > > -- > > > > > > 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] > > > > > > > > > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup > > s.com>> > > > > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup > > > > s.com> > > <nhusers%252bunsubscr...@googlegroup s.com>> > > > > > > . > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/nhusers?hl=en. > > > > > > -- > > > > > 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]<nhusers%[email protected] > > > > > > > <nhusers%[email protected]<nhusers%252bunsubscr...@googlegroup > > s.com>> > > > > . > > > > 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]<nhusers%[email protected] > > > > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- > 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.
