apache / apache/grails-core

JPA Mapping Composite ID

Open
#14,494 0 comments 0 reactions 0 assignees View on GitHub
relates-to: gorm
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

# Task List

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

Add a domain like in this commented out test case:

https://github.com/grails/grails-data-mapping/blob/f1158a73b4127a7aab41608e4ae6e0804079e544/grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/model/JpaMappingSyntaxTests.groovy#L386-L393

### Expected Behaviour

The project should compile.

### Actual Behaviour

The project fails to compile with the following error(s):

```
[...].groovy: -1: The method public java.lang.Long getId() { ... } duplicates another method of the same signature
[...].groovy:: -1: Repetitive method name/signature for method 'java.lang.Long getId()' in class '[...]'
[...].groovy:: -1: Repetitive method name/signature for method 'java.lang.Long getId()' in class '[...]'
```

### Environment Information

- **Operating System**: macOS 10.15.7
- **GORM Version:** 7.0.4
- **Grails Version (if using Grails):** 4.0.3
- **JDK Version:** 8

Contributor guide

Open the contributing guide

Research direction

Start with the commented-out test case in grails-datastore-core/src/test/groovy/org/grails/datastore/mapping/model/JpaMappingSyntaxTests.groovy at lines 386-393 and reproduce the compilation failure. Trace the composite-ID mapping behavior that produces duplicate getId() methods. Done means the domain compiles without the reported duplicate-method errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.