> I was wondering what happens with the QueryTargetPolicy when you execute Criteria API based queries.
I think it will bomb :) Slice was developed before Criteria Query came into being. Background info: The internal structure that carries the to name of the target slices to query execution module is FetchConfiguration. And the target slice names are attached to FetchConfiguration as hint with key "openjpa.hint.slice.Target" or typo-safe logical constant SlicePersistence.HINT_TARGET. Now normal, spec-compliant method Query.setHint(...) also populate the same FetchConfiguration. Given this background, an user application using Slice can always call javax.persistence.Query q = // create query by JPQL or Criteria List<String> myListOfTargetSliceNames = // decision logic to target a query to subset of slices q.setHint(SlicePersistence.HINT_TARGET, myListOfTargetSliceNames); The introduction of QueryTargetPolicy is actually a thin wrapper so that a) user application can localize the the logic that determines the target slice names for each query. b) the requisite q.setHint(..) gets automagically called by Slice runtime before query execution, so user application does not have to. So effectively, a) Queries can be targeted for Criteria Query as well with currently available mechanics b) A user application can as well build a discipline (that does *not* implement QueryTargetPolicy) by directly setting hints on spec-compliant Query interface before execution. Thank you for using Slice :) ----- Pinaki -- View this message in context: http://openjpa.208410.n2.nabble.com/Slice-QueryTargetPolicy-with-Criteria-API-tp6347460p6348631.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
