This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

refresh state problem

Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

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.

Carlos .
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Carlos Conti
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

    Bookmark Topic Watch Topic
  • New Topic