We have an application that uses JPA for DB access. We are using hibernate JPA/entity managers.
There are 2 JVM processes, one for the web front end and one for the core processing engine.
Currently each JVM talks to the DB directly via JPA/entity managers. But we get a lot of problems with refreshes. If the user makes a change to the data via the web front end, it saves it to the DB and then sends a signal to the other JVM to do a refresh. We then do an entityManager.refresh on the specified object.
This does not seem to do a deep refresh, especially when objects/rows are deleted. We get entity not found exceptions. We've hacked around it a bit by clearing the local collections which seems to help sometimes and JPA then reloads the child objects.
My question is - is this a bug in hibernate and/or our configuration and the refreshes should work or should the DB layer be done from one JVM and the other layers should go through that JVM for db updates etc.