In normal use cases, it's recommended to leverage Infinispan as JPA second level cache and/or query cache. However, if you'd like to use only Infinispan API and you want Infinispan to read from database, or to persist the data into a database with well defined schema, then JPA cache store could be right for you.
Prior to JPA cache store, those who wants to use Infinispan in front of a database to read/write database records would need to write their own cache store implementation. Now, with JPA cache store, users can use Infinispan in front of a database (write-through or write-behind) with ease by using standard JPA mapping and configurations.
To use the cache store is simple - create the standard JPA configuration (persistence.xml) and entity class, and then configure the cache store:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<namedCache name="usersCache"> | |
<loaders passivation="false" shared="true" preload="true"> | |
<jpaStore | |
persistenceUnitName="myPersistenceUnit" | |
entityClassName="my.package.User" | |
/> | |
</loaders> | |
</namedCache> |
Please see documentations for detailed sample usage and configuration.
Hope you enjoy this new addition!
Ray
This seems very good and beneficial. Thanks for sharing. You can now adhere to a glowing skin all along with Dermology anti aging cream.
ReplyDelete