apache / apache/grails-core

Changing name of association column name

Open
#14,465 1 comment 1 reaction 0 assignees View on GitHub
relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

In app I am working on we already have tables where columns are named in camel case (for example "userId"). And dont want to add column name in mapping for each association in domain.
Currently, default behavior for naming columns for associations is just to add "_id" which is set [here](https://github.com/grails/gorm-hibernate5/blob/master/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L82)
So is it possible to make `FOREIGN_KEY_SUFFIX` configurable, that will be great, or at least not `final protected` so it can be changed?

Contributor guide

Open the contributing guide

Research direction

Start with grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java and inspect how FOREIGN_KEY_SUFFIX is used when association columns are generated. Trace the configuration and mapping entry points to determine where a configurable suffix could be supported, with completion meaning camel-case association columns work without per-association column mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.