Fabio, Alright - I see what you're getting at...something like this: http://elegantcode.com/2009/07/19/nhibernate-2-1-and-collection-event-listeners/ (but obviously handing validation events)
Also...wouldn't we be interested in IPreCollectionUpdateEventListener IPreCollectionRemoveEventListener Instead of the "Post" ones? I imagine these would need to examine only "Size" and "NotNull" validation attributes on collections, to ensure that the contraints specified were satisfied. Is this along the lines of what you were thinking? On Mar 12, 10:55 am, Fabio Maulo <[email protected]> wrote: > 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 welcomehttp://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- 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.
