Identity enumType for Set of enums
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Task List
- [ ] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Full description of the issue provided (see below)
### Steps to Reproduce
In grails 3.3 currently impossible to define enumType for a collection of enums. It works only for a separate field:
https://docs.grails.org/latest/ref/Database%20Mapping/column.html
@jameskleeh wrote: **I don't think this is possible currently**
https://stackoverflow.com/questions/50210992/grails-3-enumtype-for-set-of-enums?noredirect=1#comment87450991_50210992
With grails 3.2 following code works well, but with grails 3.3 it use enum names during saving to DB
```
class Test {
Set enums
static mapping {
enums enumType: 'identity' // not works
}
}
enum TestEnum {
final int id
TestEnum(int value){
...
}
}
```
- **Operating System**: TODO
- **GORM Version:** 6.1.9
- **Grails Version (if using Grails):** 3.3.5
- **JDK Version:** TODO
### Example Application
- TODO: link to github repository with example that reproduces the issue
Contributor guide
Research direction
Start by comparing Grails 3.3/GORM 6.1.9 collection enum mapping with the reported Grails 3.2 behavior and the column mapping documentation linked in the issue. Confirm the behavior with the shown Test and TestEnum mapping; done means a Set of enums persists and reloads using each enum's identity value rather than its name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100