version property injected and considered a persistentProperty regardless of version mapping
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
- [x] Steps to reproduce provided
- [x] Stacktrace (if present) provided
- [x] Example that reproduces the problem uploaded to Github
- [x] Full description of the issue provided (see below)
### Steps to Reproduce
1. define a domain class `Dummy` with
```groovy
static mapping = {
version false
}
```
2. try to access `new Dummy().version` or check the entities' `persistentProperties`
### Expected Behaviour
no version property is injected because of `version false`
### Actual Behaviour
* a version property is injected and considered a persistent property.
* `GormEntityTransformation` seems to injected it regardless of the verison mapping: https://github.com/grails/grails-data-mapping/blob/v6.1.10/grails-datastore-gorm/src/main/groovy/org/grails/compiler/gorm/GormEntityTransformation.groovy#L447-L454
* but `PersistentEntity.isVersioned()` returns `false`
* the actual db column is not created
### Environment Information
- **Operating System**: win x64
- **GORM Version:** 6.1.10
- **Grails Version (if using Grails):** 3.3.6
- **JDK Version:** oracle 8u151
### Example Application
sample app will be referenced asap
Contributor guide
Research direction
Start with GormEntityTransformation.groovy around lines 447-454 and reproduce the issue using a Dummy domain class with mapping version false. Compare the injected version property and persistentProperties with PersistentEntity.isVersioned() and the database schema. Done means version is not exposed as a persistent property when versioning is disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100