Invalidating Toplink Session Cache To Avoid Stale Data
Toplink is a Java framework that maps objects to database tables. It is the reference implementation for the Java Persistence Architecture, or JPA. Developers use Toplink to manage data persistence (storage), queries, and transactions in an Oracle database. By default, Toplink makes use of a special cache called a Session Cache, maintained on the server, which is meant to speed up performance. Queried data is stored in the Session Cache and used in subsequent queries to reduce or eliminate calls to the database.
One problem with this approach is how to deal with “stale data”. In other words, what happens when data is changing in the database? How does the developer ensure that the cached data is current?
Hello, and thanks for visiting my blog! My name is Toby Marks, and I am a consultant with Enkitec, an Oracle partner headquartered in Dallas, Texas specializing in DBA services and Exadata implementations. I have worked as a developer-consultant for 15 years in the Dallas/Ft. Worth area. In this blog I hope to share some of my experiences, perspectives, and solutions to problems I have encountered at the various places I have worked.