jamesfredley commented on issue #14624:
URL: https://github.com/apache/grails-core/issues/14624#issuecomment-5944820789

   This mapping is ambiguous, and GORM does not choose the inverse side for you.
   
   `hasMany = [otherProducts: SuperProduct, products: Product]`, with `Product` 
extending `SuperProduct`, gives both collections a type that matches a 
`Product`. `GormMappingConfigurationStrategy.findOneToManyThatMatchesType` 
returns the first eligible collection, and Hibernate then maps both sides onto 
the same `iteration_id` column.
   
   The resolution already on this issue is the supported one:
   
   ```groovy
   static mappedBy = [products: 'iteration', otherProducts: 'none']
   ```
   
   `mappedBy` exists for this case: two associations whose types GORM cannot 
tell apart. https://docs.grails.org/latest/ref/Domain%20Classes/mappedBy.html
   
   `establishRelationshipForCollection` honors an explicit `mappedBy`, 
including `'none'`. It does not disambiguate this hierarchy on its own. 
`SubclassMultipleListCollectionSpec` is still `@Ignore` and keeps that 
`mappedBy` as the commented resolution. Closing as not a defect. If `mappedBy` 
is omitted, the failure is still Hibernate's "Repeated column in mapping for 
entity".
   


-- 
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]

Reply via email to