jamesfredley commented on code in PR #16686:
URL: https://github.com/apache/grails-core/pull/16686#discussion_r4338912639
##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionKeyColumnUpdater.java:
##########
@@ -39,19 +40,23 @@ public CollectionKeyColumnUpdater(CollectionKeyBinder
collectionKeyBinder) {
public void bind(HibernateToManyProperty property) {
DependantValue key = collectionKeyBinder.bind(property);
key.getColumns().stream().filter(Objects::nonNull).forEach(column ->
column.setNullable(true));
+ Table collectionTable = property.getCollection().getCollectionTable();
long unidirectionalCount = property.getHibernateOwner()
.getPersistentPropertiesToBind()
.stream()
- .filter(HibernateToManyProperty.class::isInstance)
+ .filter(HibernateToManyProperty::isBoundAsCollection)
.map(HibernateToManyProperty.class::cast)
.filter(p -> !p.isBidirectional())
+ .filter(p ->
Objects.equals(p.getCollection().getCollectionTable(), collectionTable))
Review Comment:
This changes user-visible persistence. An owner with two unidirectional
hasMany associations now writes the join table when each association has its
own table, and still does not when they share one. That distinction is not in
`grails-doc` or the GORM upgrade notes.
Please add a short public note: separate join tables are written; a shared
join table is still the 10811 case and is not fixed by this change alone. A
bugfix that changes which rows get written is a user-facing change and needs
that coverage.
--
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]