apache / apache/grails-core

naming_strategy only works with strings

Open
#14,645 0 comments 0 reactions 0 assignees View on GitHub
relates-to: gorm type: minor
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Hey there,

According to documentation [here](https://grails.github.io/grails-doc/3.0.x/guide/GORM.html#customNamingStrategy), there are 3 options available to provide a custom naming strategy. However it appears to only work when I use a String for the classname.

https://github.com/grails/grails-data-mapping/blob/master/grails-datastore-gorm-hibernate4/src/main/groovy/grails/orm/bootstrap/HibernateDatastoreSpringInitializer.groovy

`def namingStrategy = config.getProperty("hibernate${suffix}.naming_strategy") ?: ImprovedNamingStrategy`

`getProperty` may be the problem? Will only return strings, null for anything else.

Thanks

Contributor guide

Open the contributing guide

Research direction

Read grails-datastore-gorm-hibernate4/src/main/groovy/grails/orm/bootstrap/HibernateDatastoreSpringInitializer.groovy and the linked custom naming strategy documentation. Start at the hibernate naming_strategy configuration lookup and verify how non-string values are handled. Done means the documented naming-strategy options work when configured with a class rather than only a String.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.