Table of Contents
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.
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.