Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: what happens with caching when using DSL alongside DAO #1593

Open
IgnatBeresnev opened this issue Sep 10, 2022 · 0 comments
Open

Comments

@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Sep 10, 2022

Hi!

Recently I stumbled upon the same problem as described in #914, where I have to upsert a value (using this library) and then retrieve it by calling Entity.findById - it returns cached entity with outdated values. I've solved that by calling Entity.removeFromCache after doing an upsert, but that got me thinking

How safe is it to be using DSL queries alongside DAO? Is entity cache somehow updated/invalidated when DSL queries are performed?

In other words, if I update an entity without explicitly committing/flushing, and then call some service which performs a DSL query to find this entity - will I see the updated value? Not necessarily interested in this particular case, but in similar cases in general, where you have a mix of DSL/DAO operations within the same transaction

Should I stick to DSL only if I want to avoid possible cache-related problems?

Asking because DAO API is not as flexible, so I have to be doing DSL queries in between.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant