I have an entity for a table that is updated constantly. Although the first level cache is fine for most entities, it actually just gets in the way for this specific entity. Right now it seems like the only way for me to force a manual refresh when I do a JPQL query for this entity is either to:
a. close and reacquire the entity manager, or
b. iterate all entities returned by my query and refresh them individually.
These are easy to do code-wise but I don’t feel very satisfied in terms of performance.
I am also doing this for the query:
…but it has no effect. I’m guessing this is only relevant for the second-level cache? Is there any way to do what I need to do without having to resort to either of the two approaches I described?