Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Auditing doesn't work on entities in Datastore when running through DatastoreTemplate.performTransaction() #2603

Closed
fpavageau opened this issue Nov 28, 2020 · 2 comments · Fixed by #2604
Labels

Comments

@fpavageau
Copy link
Contributor

When using DatastoreTemplate.performTransaction() with spring-cloud-gcp-data-datastore 1.2.6.RELEASE, auditing doesn't work for entities.

That's because the new DatastoreTemplate instance created in performTransaction() does not have the ApplicationEventPublisher of the original one, which is the mechanism by which the AuditingHandler eventually gets called to set the auditing properties.

I've added a test to DatastoreTemplateAuditingTests in my fork which demonstrates the problem.

I also have a simple fix ready, if it's actually a bug and you want a PR.

@meltsufin
Copy link
Contributor

Hi @fpavageau! Thanks for a detailed description, test, and fix!
We'll be happy to accept the fix, if you can open a PR!

@fpavageau
Copy link
Contributor Author

OK, I've squashed the test commit with the fix commit and opened the PR.

meltsufin pushed a commit that referenced this issue Nov 30, 2020
#2604)

The new `DatastoreTemplate` instance should have the same
`ApplicationEventPublisher` as the original one, so that `AuditingHandler`
can be called.

Fixes: #2603.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

2 participants