Chapter 2. Working with the GemFire APIs

Once the GemFire cache and regions have been configured they can injected and used inside application objects. This chapter describes the integration with Spring's DaoException hierarchy.

2.1. Exception translation

Using a new data access technology requires not just accommodating to a new API but also handling exceptions specific to that technology. To accommodate this case, Spring Framework provides a technology agnostic, consistent exception hierarchy that abstracts one from proprietary exceptions to a set of focused data access exceptions. As mentioned in the Spring Framework documentation, exception translation can be applied transparently to your data access objects through the use of the [Repository] attribute and AOP by defining a PersistenceExceptionTranslationPostProcessor object. The same exception translation functionality is enabled when using GemFire as long as at least a CacheFactoryObject is declared. The Cache factory acts as an exception translator which is automatically detected by the Spring infrastructure and used accordingly.