apache / apache/grails-core

Delete doesn't work with assigned id name strategy

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

Description

Delete seems not to work in this test case. Works fine if you comment out the static mapping for id generator...
```groovy
class AssignedIdDeleteSpec extends Specification {

@Shared
@AutoCleanup
Neo4jDatastore datastore = new Neo4jDatastore(ThingToDelete)

@Rollback
void "delete"() {
given:
def thing = new ThingToDelete(name: "thing1")
thing = thing.save(flush: true)
thing = thing.delete()

expect:
def found = ThingToDelete.findByName("thing1")
found == null
}
}

@Entity
class ThingToDelete {
String name
static mapping = node {
id {
generator "assigned"
name "name"
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the AssignedIdDeleteSpec example and the Neo4jDatastore configured for ThingToDelete. Trace delete handling when the id generator is assigned and the mapping names the id property; done means ThingToDelete.findByName("thing1") returns null after deletion.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, neo4j
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.