user7916020 user7916020 - 3 years ago 107
Java Question

jpa entities on different applications

I have a java backend integration application (no UI) spring/jpa based.
now I am creating a UI web application (also spring/jpa based) to support queries on the backend application.
So I will have two applications (jvms) using the same DB.
My question is - will cahanges in the DB made by the backend integration application , be reflected on the jpa entities of the UI application ? or I have to force my entities to always go to the DB in order to be up to date ?

Answer Source

There is no magical synchronisation of changes between the different JVMs. The UI application will only see changes that have been persisted into the DB by the backend application. So, in short, yes you will need to force DB persistence/lookup for your entities.

Note that you may also run into caching issues (for example, Hibernate does some automatic caching of entities by default). If the UI application has cached an entity, it will not see changes made by the backend application even if persisted into the DB, until the UI application does a new query to the DB itself as well.

Therefore I would advise you to test this thoroughly and adjust your configuration as necessary.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download