apache / apache/grails-core

"Repeated column in mapping for entity" when using subclasses in multiple hasMany collections

Open
#14,624 3 comments 0 reactions 1 assignee Claimed by @graemerocher View on GitHub
relates-to: gorm type: minor
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

See the sample app in the linked repo for the example.

Given a domain class and a subclass, and a third class which uses both parent and subclass as `hasMany` collections:

`static hasMany = [otherProducts: SuperProduct, products: Product]`

... if the subclass collection is typed as `List`:

`List products`

...app startup will fail with this error from Hibernate:

```
Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.hibernate.MappingException: Repeated column in mapping for entity: com.ociweb.Product column: iteration_id (should be mapped with insert="false" update="false")
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.