Author: ppoddar Date: Wed May 12 21:22:33 2010 New Revision: 943695 URL: http://svn.apache.org/viewvc?rev=943695&view=rev Log: OPENJPA-1663,OPENJPA-1664: document Query/Finder Target Policy. Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_slice.xml Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_slice.xml URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_slice.xml?rev=943695&r1=943694&r2=943695&view=diff ============================================================================== --- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_slice.xml (original) +++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_slice.xml Wed May 12 21:22:33 2010 @@ -19,7 +19,7 @@ --> - Distributed Persistence + Slice: Distributed Persistence The standard JPA runtime environment works with a single @@ -113,7 +113,7 @@ However, the application can target the query only to a subset of slices by setting hint on javax.persistence.Query. The hint key is openjpa.hint.slice.Target and - hint value is a comma-separated list of slice identifiers. The following + hint value is an array of slice identifiers. The following example shows how to target a query only to a pair of slices with logical identifier "One" and "Two". @@ -122,7 +122,7 @@ em.getTransaction().begin(); String hint = "openjpa.hint.slice.Target"; Query query = em.createQuery("SELECT p FROM PObject") - .setHint(hint, "One, Two"); + .setHint(hint, new String[]{"One", "Two"}); List result = query.getResultList(); // verify that each instance is originating from the hinted slices for (Object pc : result) { @@ -132,6 +132,28 @@ ]]> + + + To confine queries to a subset of slices via setting query hints can be considered + intrusive to existing application. The alternative means of targeting queries is to + a configure a <Query Target Policy. This policy is configured + via plug-in property openjpa.slice.QueryTargetPolicy. The + plug-in property is fully-qualified class name an implementation + for org.apache.openjpa.slice.QueryTargetPolicy interface. + This interface contract allows an user application to target a query select a subset + of slices based on the query and its bound parameters. The query target policy is consulted + only when no explicit target hint is set on the query. By default, the policy + executes a query on all available slices. + + + + A similar policy interface org.apache.openjpa.slice.FinderTargetPolicy + is available to target queries that originate from find() + by primary key. This finder target policy is consulted + only when no explicit target hint is set on the current fetch plan. By default, the policy + executes a query on all available slices to find an instance by its primary key. + To confine queries to a subset of slices via setting query hints can be considered +
Data Distribution