DATADOC-24 - Adapted changes from Spring Data Commons.

This commit is contained in:
Oliver Gierke
2011-02-16 20:30:33 +01:00
parent cd4013fe1d
commit e22bee3e3f
3 changed files with 12 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.query.SimpleParameterAccessor;
import org.springframework.data.repository.query.ParameterAccessor;
import org.springframework.data.repository.query.parser.PartTree;
@@ -41,9 +41,8 @@ public class JpaCountQueryCreator extends JpaQueryCreator {
* @param domainClass
* @param em
*/
public JpaCountQueryCreator(PartTree tree,
SimpleParameterAccessor parameters, Class<?> domainClass,
EntityManager em) {
public JpaCountQueryCreator(PartTree tree, ParameterAccessor parameters,
Class<?> domainClass, EntityManager em) {
super(tree, parameters, domainClass, em);
}

View File

@@ -23,9 +23,10 @@ import javax.persistence.Query;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.repository.query.ParameterAccessor;
import org.springframework.data.repository.query.Parameters;
import org.springframework.data.repository.query.ParametersParameterAccessor;
import org.springframework.data.repository.query.QueryMethod;
import org.springframework.data.repository.query.SimpleParameterAccessor;
import org.springframework.util.Assert;
@@ -163,8 +164,8 @@ public abstract class JpaQueryExecution {
@SuppressWarnings("unchecked")
protected Object doExecute(PartTreeJpaQuery query, Object[] parameters) {
SimpleParameterAccessor accessor =
new SimpleParameterAccessor(this.parameters, parameters);
ParameterAccessor accessor =
new ParametersParameterAccessor(this.parameters, parameters);
Query countQuery = query.createCountQuery(parameters);
Long total = (Long) countQuery.getSingleResult();

View File

@@ -21,7 +21,8 @@ import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaQuery;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.query.SimpleParameterAccessor;
import org.springframework.data.repository.query.ParameterAccessor;
import org.springframework.data.repository.query.ParametersParameterAccessor;
import org.springframework.data.repository.query.parser.PartTree;
@@ -61,8 +62,8 @@ public class PartTreeJpaQuery extends AbstractJpaQuery {
*/
public Query createQuery(Object[] parameters) {
SimpleParameterAccessor accessor =
new SimpleParameterAccessor(getParameters(), parameters);
ParameterAccessor accessor =
new ParametersParameterAccessor(getParameters(), parameters);
JpaQueryCreator jpaQueryCreator =
new JpaQueryCreator(tree, accessor, domainClass,
@@ -90,7 +91,7 @@ public class PartTreeJpaQuery extends AbstractJpaQuery {
public Query createCountQuery(Object[] parameters) {
CriteriaQuery<Object> query =
new JpaCountQueryCreator(tree, new SimpleParameterAccessor(
new JpaCountQueryCreator(tree, new ParametersParameterAccessor(
getParameters(), parameters), domainClass,
getEntityManager()).createQuery();
return getEntityManager().createQuery(query);