1 | initial version |
Yes, it is possible to personalize the names of columns in an abstract domain class using Grails. This can be done by using the static mapping
block in the domain class and specifying a column
attribute for each property that needs to be customized.
For example, suppose we have an abstract domain class Person
:
abstract class Person {
String firstName
String lastName
}
If we want to customize the column names for firstName
and lastName
, we can do it like this:
abstract class Person {
String firstName
String lastName
static mapping = {
firstName column: 'first_name'
lastName column: 'last_name'
}
}
This will create columns named first_name
and last_name
in the database table for each subclass of Person
.