Apr 1 2009

Caching in Persistence

Murat

Recently, I’ve added necessary methods to connect last.fm accounts of users and synchronize them. While testing new features, I’ve realized an instability in the database. It is due to the caching feature (not bug) of Java Persistence API. If you run a query through Persistence, then edit something from database directly, JPA does not recognize it. If you run the same query again, you get exactly the previous result. That’s why, if you use Persistence somewhere in your application, you should better use it throughout your application and not to access the database by another method. You may also modify caching properties of Persistence but it is not recommended because of performance loss. Detailed information can be found here: http://blogs.sun.com/enterprisetechtips/entry/how_to_get_the_best

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • FriendFeed
  • LinkedIn
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Leave a Reply