For now I have field "String firstName" it converted to "first_name" and i want "firstname" as default in Hibernate. Is it posible?
5.5.2.1 Table and Column Names
class Person {
String firstName
static mapping = {
table 'people'
firstName column:'firstname'
}
}
You can change the naming strategy for the entire project. From the documentation http://grails.org/doc/latest/guide/5.%20Object%20Relational%20Mapping%20(GORM).html#5.5.2.12.
By default Grails uses Hibernate's ImprovedNamingStrategy to convert domain class Class and field names to SQL table and column names by converting from camel-cased Strings to ones that use underscores as word separators. You can customize these on a per-instance basis in the mapping closure but if there's a consistent pattern you can specify a different NamingStrategy class to use.
Configure the class name to be used in grails-app/conf/DataSource.groovy in the hibernate section, e.g.
So, something like this in your DataSource.groovy
dataSource {
pooled = true
dbCreate = "create-drop"
…
}
hibernate {
cache.use_second_level_cache = true
…
naming_strategy = org.hibernate.cfg.DefaultNamingStrategy
}