Saturday, May 12, 2018

Up-to-Date Cache With EclipseLink and Oracle

DZone Database Zone
Up-to-Date Cache With EclipseLink and Oracle
Up-to-Date Cache With EclipseLink and Oracle

One of the most useful features provided by ORM libraries is a second-level cache, usually called L2. An L2 object cache reduces database access for entities and their relationships. It is enabled by default in the most popular JPA implementations like Hibernate or EclipseLink. That won’t be a problem unless a table inside a database is not modified directly by third-party applications, or by the other instance of the same application in a clustered environment. One of the available solutions to this problem is an in-memory data grid, which stores all data in memory, and is distributed across many nodes inside a cluster. Such a tool like Hazelcast or Apache Ignite have been described several times in my blog. If you are interested in one of that tools I recommend you read one of my previous article about it: Hazelcast Hot Cache with Striim.

However, we won’t discuss it in this article. Today, I would like to talk about the Continuous Query Notification feature provided by Oracle Database. It solves a problem with updating or invalidating a cache when data changes in the database. Oracle JDBC drivers have provided support for it since 11gRelease 1. This functionality is based on receiving invalidation events from the JDBC drivers. Fortunately, EclipseLink extends that feature in their solution called EclipseLink Database Change Notification. In this article, I’m going to show you how to implement it using Spring Data JPA together with the EclipseLink library.

No comments:

Fun With SQL: Functions in Postgres

DZone Database Zone Fun With SQL: Functions in Postgres In our previous  Fun with SQL  post on the  Citus Data  blog, we covered w...