I am runnign some maintainance tasks and need to update hierarchy relationships between my entities. The process is successful. However I have to restart the application contianer in order to update the contents in the application. Therefore I am having a refresh problem in my Persistence methods.
Let me post the main two methods I use.
May there be something I am missing in the reading method, to get the most fresh version of the instance?
Thanks for your help.
Joined: Oct 01, 2007
What JPA provider are you using?
How does your maintenance task modify the database, directly or through JPA?
It seems like you are using a shared cache (L2 cache).
You need to either,
- clear / invalidate the cache after running your
- refresh your objects
- disable the shared cache
JPA 2.0 provides cache configuration and API. If using JPA 1.0, you will need to use configuration specific to your JPA provider.
Hi James, thanks for your answer.
Let me clarify one point which may have not been clear enough in my first post.
On one side I use EclipseLink1.1 (the contained application, with Tomcat 6.0). The maintenance application is a pure batch task which we let run from time to time to update some pieces of information. On this side I use aswell EclipseLink 1.1 but since running it in my machine in a local copy of the database, I use a different persistenceunit. But both share the same ORM Mapping file. The point is that if I perform a change via the maintenance task, when running the web application at the same time (locally of course), the changes are not noticeable until I restart the web application.
So I use two different persistent units to attack the same db, merely to distinguist the context (RESOURCE_LOCAL vs. JTA). In fact in the server the db runs in the same box as the web application, however I preferred to have things settled from the very beginning.
Many thanks for your post. I will have a close look to the link you provided.