grailsabstract-classlast-modifieddatecreated

Can I customize column names for an abstract domain class in Grails?


I have an Abstract Domain Class in Grails wich has fields that all the other class will use, so the other class extends of it. This field are audit fields. I use the automatic timestamp fields: dateCreated and LastUpdated and two other String fields.

I need the columns to have specific names, and for some reason the column name mapping is not working.

static mapping = {
    createUser column: "AUDI_TCREATE_USER"
    editUser column: "AUDI_TEDIT_USER"
    dateCreated column: "AUDI_DDATE_CREATED"
    lastUpdated column: "AUDI_DDATE_MODIFIED"
    tablePerHierarchy false
}

String createUser
String editUser
Date dateCreated
Date lastUpdated

It does not throw any errors but it just keeps the original column name in the DB for every field.


Solution

  • No. You have to define mappings in each domain class, which extends your abstract domain class. I am speaking about grails 1.3.x.