More than a workaroud we should think about a solution IPostCollectionUpdateEventListener IPostCollectionRemoveEventListener
Can you study it a little bit and send me a proposal ? If you have time obviously. btw a JIRA ticket is welcome http://216.121.112.228/browse/NHV 2010/3/12 DanPlaskon <[email protected]> > Hello, > > I have a "Size" validation constraint specified for a collection on an > entity of mine (Min is set to 1, to specify that the entity must have > at least one child entity in its collection). > > This works as expected for the initial creation, however validation > does not occur upon update of the entity if the only change made to it > is to remove all child entities from the collection. I imagine this > occurs because the entity itself is not considered dirty (since the > only changes made were to its collection of child entities), and thus > the ValidatePreUpdateEventListener does not evaluate it at all. > However, this poses a problem, because the entity has technically > entered an invalid state (its collection does not contain any child > entities) and NHibernate is all to happy to remove all child entities > without checking the validity of the parent. > > So...that being said...what's the workaround for this? If further > details are required, please don't hesitate to ask :) > > -- > 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.
