Outdated data in Hibernate + JPA queries

Asked

Viewed 120 times

0

I noticed a problem in my Spring application, I am implementing an internal messaging service and when creating the display of the amount of unread messages I realized that the value varied with each update, whenever a new message arrived.
In short, whenever an insertion or update occurs I have an intercalation of the outdated with the updated in each new query performed.

Ex: When I display the amount of unread messages the result is varying as follows with each update: 1, 2, 1, 2, 1...

The same problem is happening throughout the system, but in other functionalities is less noticeable.

I tried to disable the Hibernate cache and clear the EntityManager, but the problem persists.

  • @Tiagos you seem to have approved this edition here http://answall.com/review/suggested-edits/72974 but it is an attempt to add code from a "third party" that changes the author’s purpose.

  • 1

    Opa @diegofm, I was watching my analysis and I saw now, I was sorry. Yes, it was a fault of my own, I was doing the analysis by cell phone and I was going to click to reject for this reason only that accidentally I ended up clicking to approve and then it was already. I’ll be more careful next time.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.