Error when updating a dynamic association in a newly created object
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
This test also fails in master.
I created a PR for 6.0.x.BRINQA, but it might not be the best solution.
def "Test update newly created object"() {
setup:
def victor = new Pet(name: 'Victor')
def fritz = new Pet(name: 'Fritz')
def franz = new Pet(name: 'Franz')
def heinrich = new Pet(name: 'Heinrich')
victor.buddies = [fritz, franz]
when:
victor.save()
heinrich.save()
session.flush()
then:
victor.buddies.name.sort() == ['Franz', 'Fritz']
when: "Adding an element"
victor.buddies.add(heinrich)
def cousin = victor.cousin
then:
victor.buddies.name.sort() == ['Franz', 'Fritz', 'Heinrich']
when:
victor.markDirty("buddies")
victor.save()
session.flush()
victor.discard()
victor = Pet.findByName("Victor")
then:
victor.buddies.name.sort() == ['Franz', 'Fritz', 'Heinrich']
}
Contributor guide
Research direction
Start by reproducing the failure in the shown Groovy test, especially the dynamic buddy association and the save/flush sequence. Done means the test passes: adding Heinrich to victor.buddies survives save, reload, and the final association assertion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100