Configuring Transactions

The Spring framework provides a transaction programming model that can work across multiple APIs. GemFire provides a per-cache transaction manager that you can use to execute region data operations atomically.

For example, the following Spring application context XML configuration (from the quickstart/transaction example) declares a cache, region, and transaction manager using default names. (gemfireCache) for the cache and gemfireTransactionManager for the transaction manager):
<gfe:cache properties-ref="gemfire-props"/>
<gfe:replicated-region id="Customer"/>
The following Java class (from the quickstart/transaction example) references the transaction manager:
public class CustomerService {
	@Autowired CustomerRepository customerRepository;
	 * @param customer
	 * @param fail - set to true to simulate some downstream processing that 
  *  throws an exception which should trigger a rollback 
	public void updateCustomer(Customer customer, boolean fail) {;
		 if (fail) {
			 throw new RuntimeException
     ("Updated failed - should trigger a rollback.");
	public Customer getCustomer(long id) {
		return customerRepository.findOne(id);

Additional Resources