You should create new post to ask a new question. There is not actually a NH way, but a "transactional way" is to either commit the changes or rollback the whole thing. This is usually done by exception handling.
Just an example in pseudo code: try { cat = Load(id); cat.Name = "some name"; Validate(cat); // throws exception session.Commit(); } catch { session.Rollback(); } On 14 Aug., 09:30, mipi <m.pieli...@gmail.com> wrote: > My first message here, so hello :) I am very new to NHibernate, but I > like it already. > > > The "normal" solution for unexpected updates is: if the business logic > > does not want to have something changed, it should not change it. > > I have a question what is the "NHibernate way" of doing this simple > task? > I've slightly modified the example from the documentation. > > sess = sf.OpenSession(); > ITransaction tx = sess.BeginTransaction(); > Cat izi = (Cat) sess.Load(typeof(Cat), id); > > izi.Name = "iznizi#...@*"; > > if (izi.IsValid()) > // persist it here > > tx.Commit(); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhusers@googlegroups.com To unsubscribe from this group, send email to nhusers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---