Using Hibernate 3.5.1 and MSSQL 2008
Hi trying to implement the typical DateCreated and DateModified columns. The issue I have is that the time must be set from the DB not the application.
For DateCreated I can set the property to generated = always and set a default constraint (yes that reads right damn MS) on MS SQL 2008 to a default value of GetDate()
How would I go about it for DateModified?
Well, you should actually use
generated = insertfor the creation date, it is not supposed to change upon subsequent updates and this will save an additional select for this column during updates.And this is where you should use
generated = always(and a trigger on the database side).Here is what the reference documentation writes about them: