You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jamesfredley (via GitHub)" <gi...@apache.org> on 2026/10/21 16:50:12 UTC
[I] Enum unique group fails startup when a grouped association has multiple columns [grails-core]
jamesfredley opened a new issue, #16713:
URL: https://github.com/apache/grails-core/issues/16713
## Summary
#16533 made enum binding create a unique-group key. That new call looks up every other property in the group through the single-column column-name accessor. If one of those properties is a to-one association mapped to more than one column, datastore startup throws `Cannot treat multi-column property as a single-column property`.
## What goes wrong
`EnumTypeBinder.bindEnumType()` now calls `CreateKeyForProps.createKeyForProps()`. For `state unique: 'parent'`, that walks the group and asks for the other property's column name with a null `ColumnConfig`.
`ColumnNameForPropertyAndPathFetcher` then calls `HibernatePersistentProperty.getColumnName(null)`, which falls through to `getMappedColumnName()`, which calls `PropertyConfig.getColumn()`. `getColumn()` calls `checkHasSingleColumn()` and throws when the property has more than one column.
A mapping that previously started now fails during metadata construction:
```groovy
class Child {
Parent parent
Status state
static constraints = {
state unique: 'parent'
}
static mapping = {
parent column: ['parent_a', 'parent_b']
}
}
```
`Parent` here has a composite identifier, or any explicit multi-column foreign key. Enum binding did not walk the unique group before this merge, so this throw is new.
## Introduced by
- https://github.com/apache/grails-core/pull/16533
- Commit `c42431349954ba6d2ed28cea6391f6964c308af6` on `8.0.x`
- `EnumTypeBinder.java` line 121, through `CreateKeyForProps.java` line 74 and `PropertyConfig.checkHasSingleColumn()`
## Fix
Resolve each group member to its full mapped column list. Do not call the single-column accessor for a multi-column association. Create the unique key over the enum column and every foreign-key column. Add a startup regression with an enum unique group that includes a composite-id association.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Enum unique group fails startup when a grouped association has multiple columns [grails-core]
Posted by "jdaugherty (via GitHub) via notifications" <no...@grails.apache.org>.
jdaugherty closed issue #16713: Enum unique group fails startup when a grouped association has multiple columns
URL: https://github.com/apache/grails-core/issues/16713
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org