You have 5 ways:1) implementation on the entity class 2) PreInsertEventListener, PreUpdateEventListener 3) Interceptor 4) Triggers 5) custom CRUD sql declared in the mapping of each entity
2009/3/18 flatline <[email protected]> > > I looked at the documentation and some articles. Most examples create > interceptors which then use DateTime.Now and not the database getdate > (). In one of Ayendes articles he shows how to use triggers, removing > the responsibility from NHibernate all together. As there are a lot of > legacy code accessing the database, including a LOT of SPROCS, > introducing triggers is not really something I would like to do. I > guess I could use Auxiliary Database Objects to create and drop > triggers every time I insert/update, but this seems like something > which could go terribly wrong in the long run. > > The property attribute "generated" is not an option since it would > require the database (triggers) to do the job. > > What I am looking for is basically a 'reverse' formula attribute. I > would like instruct NHibernate to do what it would normally do but to > use my custom sql to generate the value for a given column. Have I > overlooked something in the articles or documentation, or is this so > tricky that I should bite the bullet and use interceptors and > DateTime.Now? > > > On Mar 17, 6:26 pm, Will Shaver <[email protected]> wrote: > > Or you can do this with interceptors / event handlers if you need logic > like > > setting who it was updated by... > > > > On Mar 17, 2009 10:18 AM, "Fabio Maulo" <[email protected]> wrote: > > > > property attributes > > generated="insert"generated="always" > > > > 2009/3/17 flatline <[email protected]> > > > > > > > As I understand it NHibernate has a build in support for > timestamps. > > > > > However, it appears yo... > > > > -- > > 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 -~----------~----~----~----~------~----~------~--~---
