spring-projects / spring-projects/spring-data-jpa
Auditing Users does not work [DATAJPA-1697]
@schauder is already working on this.
Since Dec 30, 2020.
- Dominant language
- Java
- Stars
- 3.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
anpieber opened DATAJPA-1697 and commented
Dear Spring-Development-Team,
Auditing for users is not working for quite a while now (since the upgrade from 2.0.4.RELEASE to 2.1.4.RELEASE). I know that it worked before the upgrade. It just took me lots of time finding out, that it does no longer work...
The core problem is that the AuditingEntityListener is expecting the object to be modified in place, but the AuditingHandler returns a new object. Therefore the changes never make the way into the DB. In fact I debugged the problem and it's located somewhere in the AuditableBeanWrapper class. If you monitor the target object in the wrapper (AuditableBeanWrapper) it stays bascially the same until this line. auditor.filter(__ -> isNew).ifPresent(foo -> wrapper.setCreatedBy(foo)); (AuditingHandler:198). Debugging the path further down you see that the object inside wrapper is modified in PersistentPropertyAccessor:78 in the accessor.setProperty(leafProperty, value); method call. I tried to debug into this call but intellij does not return any more information on this one.
Please feel free to contact me for any further information. Any idea would be really helpful!
Thank you very much and kind regards,
Andreas
Affects: 2.2.5 (Moore SR5)
Attachments:
- demo.zip (126.58 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.