OpenJPA Slice may be one option for JPA applications in a closed database environment.
OpenJPA Slice is available since version 1.2, and also comes with Websphere 7.0 and later. The main contract for using Slice is to save the same JPA-based application code to work with alternating horizontal partitioning of the database without any impact on the database schema. Database fragments may be from different suppliers.
Slice follows a political design that allows the user application to control which shard / slice will be stored in new instances, how queries will be asked for a subset of slices, etc.
The main limitation (which is typical of any fined environment) is that a persistent domain model must adhere to a tree-restricted scheme. Essentially, given the instance of x stored in shard A, the constant closure of x, i.e. the set of instances directly or indirectly reachable from x, should also be stored in the same shard of A. Slice automatically calculates the closure when you save x.
If an application can work with this limitation, Slice may be appropriate.
Sometimes certain instances can be split between closures, for example. Country code or currency code. Slice has a provision for replicating such instances of the "master data" type through several fragments.
Aggregated operations (MAX, MIN, SUM) that are abelian / commutative for sharding are supported. A non-Abelian aggregate such as AVG is not supported. Sorted or Top-N queries are also supported.
More information about Slice can be found in the following links.
[1] OpenJPA User Guide: http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_slice
[2] IBM Developerworks: http://www.ibm.com/developerworks/java/library/os-openjpa/?ca=drs-
source share