Chapter 12.  Distributed Persistence

Chapter 12.  Distributed Persistence

Table of Contents

1. Overview
2. Salient Features
2.1. Transparency
2.2. Custom Distribution Policy
2.3. Heterogeneous Database
2.4. Parallel Execution
2.5. Distributed Query
2.6. Targeted Query
2.7. Distributed Transaction
2.8. Collocation Constraint
3. Usage
3.1. How to activate Slice Runtime?
3.2. How to configure each database slice?
3.3. Implement DistributionPolicy interface
4. Global Properties
4.1. openjpa.slice.DistributionPolicy
4.2. openjpa.slice.Lenient
4.3. openjpa.slice.Master
4.4. openjpa.slice.Names
4.5. openjpa.slice.ThreadingPolicy
4.6. openjpa.slice.TransactionPolicy
5. Per-Slice Properties

The standard JPA runtime environment works with a single database instance. OpenJPA can be extended via plug-in to work with multiple databases within the same transaction without any change to the existing application. This capability of OpenJPA for distributed database environment is called Slice and is explained in the following sections.

1. Overview

Enterprise applications are increasingly deployed for distributed database environments. The reasons for distributed, often horizontally-partitioned database environment can be to counter massive data growth, to support multiple external clients on a hosted platform or many other practical scenarios that can benefit from data partitioning.

Any JPA-based user application has to address serious technical and conceptual challenges to directly interact with a set of physical databases within a single transaction. Slice encapsulates the complexity of distributed database environment via the abstraction of virtual database which internally manages multiple physical databases. We refer each physical database instance as slice. Virtualization of distributed databases makes OpenJPA object management kernel and the user application to work in the same way as in the case of a single physical database.

The properties to configure Slice can be classified in two broad groups. The global properties apply to all the slices, for example, the thread pool used to execute the queries in parallel or the transaction manager used to coordinate transaction across multiple slices. The per-slice properties apply to individual slice, for example, the JDBC connection URL of a slice.