Hibernate Second Level Cache

EclipseStore offers a Hibernate cache region factory, which can be found in the cache.hibernate module.

pom.xml
<dependencies>
	<dependency>
		<groupId>org.eclipse.store</groupId>
		<artifactId>cache-hibernate</artifactId>
		<version>2.0.0</version>
	</dependency>
</dependencies>

The region factory’s class name is org.eclipse.store.cache.hibernate.types.CacheRegionFactory.
It is configured via the property hibernate.cache.region.factory_class.

Depending on your environment it can be configured in different ways.

If you use a good old persistence.xml, set the property there:

persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
	xmlns="http://xmlns.jcp.org/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
	<persistence-unit name="...">
		<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
		...
		<properties>
			...
			<property name="hibernate.cache.region.factory_class"
				value="org.eclipse.store.cache.hibernate.types.CacheRegionFactory" />
			...
		</properties>
	</persistence-unit>
</persistence>

Spring Example

application.properties
spring.jpa.properties.hibernate.cache.eclipsestore.missing_cache_strategy=create
spring.jpa.properties.hibernate.cache.region.factory_class=org.eclipse.store.cache.hibernate.types.CacheRegionFactory
spring.jpa.properties.hibernate.cache.use_query_cache=true
spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.javax.persistence.sharedCache.mode=ALL
application.yml
spring:
	jpa:
		properties:
			hibernate:
				cache:
					eclipsestore:
						missing_cache_strategy: create
					region:
						factory_class: org.eclipse.store.cache.hibernate.types.CacheRegionFactory
					use_query_cache: true
					use_second_level_cache: true
			javax:
				persistence:
					sharedCache:
						mode: ALL