Grails - Using automatic timestamps, with varieable other than dateCreated and lastUpdated

StackOverflow https://stackoverflow.com/questions/17163529

  •  01-06-2022
  •  | 
  •  

سؤال

Am currently working on a Grails project, that was previously written in some other language. So we have this DB, whose table and column names, we aren't suppose to change. Now the problem is, the column name used for time-stamping is not date_created or last_updated. So is there a way that i can use grails automatic time-stamping and keep my column name unchanged?

هل كانت مفيدة؟

المحلول

How stupid can i be.. Only thing i had to do was to add the below code to my domain class

    static mapping = {
    dateCreated column: "create_date"
    lastUpdated column: "modified_date"
}

Here "created_date" and "modified_date" where my preferred column names.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top