@Fabio Um... I'm a little confused. Isn't the delegation of validation to the persistant layer a side effect of nhibernate.validator? In fact isn't that one of the stated benfits of using nhv over other validation frameworks?
In my problem I would actually like to stop the delegation but entity constraints are checked automatically when being persisted. Are you saying that you wouldn't use this feature of nhv? Thx! Gary Brunton On Jun 19, 4:43 pm, Fabio Maulo <[email protected]> wrote: > Aaaaahhhh sure but only after you have changed some properties and in the > same place you know the entity was changed. > > You are not stupid and more you are smart because you know that Flush has > all you need but... > when I change something in an entity and I need to validate it, in general, > I prefer to do it by myself (in a way or another) and don't delegate the > validation to the persistent-later nor RDBMS (I must admit that some special > validation is delegated to DB but never to NH). > > 2009/6/19 Gary Brunton <[email protected]> > > > > > > > > > @Dario, > > The flush/commit is taking part at the very end of the request and not > > in my business/service code. It is automatic and happens always. > > > @Fabio, > > I don't call a session.SaveOrUpdate from my HttpModule where the flush/ > > commit is being performed. The entity exists in the session because > > it was loaded from a repository earlier in the business/service code. > > Once it is in there, unless I evict it or clear the session the object > > will be persisted even when SaveOrUpdate is not called. > > > Now I have a good feeling that my ignorance in NHibernate is now being > > displayed with great resonance. Please feel free to tell me how > > stupid I'm being here and set me straight :) > > > Thanks. > > Gary Brunton > > > On Jun 19, 4:04 pm, Fabio Maulo <[email protected]> wrote: > > > 2009/6/19 Gary Brunton <[email protected]> > > > > > Now I'm not sure that this expatiation is any better but I wanted to > > > > update what I've decided just in case this does make sense to someone. > > > > What I do, in general, is check the state of an entity before call the > > > method, to persist an entityState, of the DAO (if the entity has an > > invalid > > > state I never call session.SaveOrUpdate). > > > -- > > > Fabio Maulo > > -- > 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 -~----------~----~----~----~------~----~------~--~---
