Because if you do it with a trigger, you need to select after each insert/update to retrieve the values and display them?
On Tue, Nov 1, 2011 at 23:20, <[email protected]> wrote: > why not just put them in a trigger in the db? > > > On , Marios Skounakis <[email protected]> wrote: > > Hi all, > > > > Consider a desktop application in which you want to timestamp records > (store the current date in fields "DateCreated" and "DateUpdated"). Since > it's running on the clients you can't reliably use DateTime.Now as each > client may have a different time, instead you somehow need to get the > database time. > > > > > > Things I have considered: > > 1. Getting the time from the database every time you need it (e.g. > before inserting or updating each record). This can be slow. > > 2. Use an interceptor to get the time from the database at session flush > and update the respective fields for all entities. > > > > 3. Use generated properties. This sounds bad too as it requires an extra > select for each insert/update. > > > > (2) seems to be the best solution. Do people agree? Is there a better > approach for this? > > > > On a related note, if you have a datetime or timestamp version property, > how does NH set its value? In principle, if you have a record that was just > inserted and never updated, DateCreated, DateUpdated and the version > property should all have the same value. > > > > > > Thanks in advance, > > Marios > > > > > > > > > > > > -- > > > > 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. > > > > > > > > > > -- > 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. > -- 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.
