Java Persistence API: Controlling the Second-Level-Cache
Using the Java Persistence API and a decent persistence provider allows us to configure and fine-tune when and how the second level cache is used in our application. In the following short examples, we’re going to demonstrate those features written as JUnit test cases and running on a H2 in-memory database. Figure 1. Persistence Unit Configuration Setup First of all we need some basic setup to run the following examples .. we need to select a JPA persistence provider and database, create a persistence-unit configuration and an environment to run tests on an in-memory database. ...