JHipster – update method called several times, cache does not seem to refresh

Strange errors can appear when updating a JHipster entity: old values are written in database, and new values are ignored. It can be a very simple edge effect to correct.

We can first believe in a Hibernate cache problem that would not be refreshed …
Then we realize that the update method of the web resource is called several times … Weird!

Well, that’s what happens when multiple tabs are open on the same app, in a development environment: BrowserSync is enabled by default for developing JHipster’s Angular layer. And BrowserSync really synchronizes all the tabs, and submits the update request in each tab!

This results in competing queries, some of which will use the old value in one of the tabs, and overwrite the new value in the database.

So, only one tab open per application!

Leave a Comment