DATADOC-24 - Adapted changes from Spring Data Commons.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user