Copilot commented on code in PR #16533:
URL: https://github.com/apache/grails-core/pull/16533#discussion_r4190792605
##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/util/CreateKeyForProps.java:
##########
@@ -48,6 +49,11 @@ protected CreateKeyForProps(
}
public void createKeyForProps(HibernatePersistentProperty grailsProp,
String path, Table table, String columnName) {
+ if (grailsProp instanceof HibernateToManyProperty) {
+ // The column of a collection property lives in the collection
table, which does not hold the columns
+ // of the other properties of the group, so a unique group has no
key to create there.
+ return;
+ }
Review Comment:
This blanket return also matches a to-many property mapped with `type:
'serializable'`. `GrailsPropertyBinder.bindProperty` explicitly sends that
supported case through `SimpleValueBinder`, so its column is on the owner table
and can validly participate in a unique group; the previous implementation
created that key. Restrict this exclusion to non-serializable to-many mappings
so this collection-table fix does not silently remove database uniqueness from
serialized collections.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]