HHH-10870 - Fix Parameter lookup for Iterable fails on Criteria API

This commit is contained in:
Andrea Boriero 2016-06-20 17:07:33 +02:00
parent c8acf1ed9e
commit aa6ab6d074
2 changed files with 6 additions and 27 deletions

View File

@ -584,8 +584,7 @@ public class CriteriaBuilderImpl implements HibernateCriteriaBuilder, Serializab
public <T> ParameterExpression<T> parameter(Class<T> paramClass) {
return new ParameterExpressionImpl<T>(
this,
paramClass,
sessionFactory.resolveParameterBindType( paramClass )
paramClass
);
}
@ -594,8 +593,7 @@ public class CriteriaBuilderImpl implements HibernateCriteriaBuilder, Serializab
return new ParameterExpressionImpl<T>(
this,
paramClass,
name,
sessionFactory.resolveParameterBindType( paramClass )
name
);
}

View File

@ -9,12 +9,10 @@ package org.hibernate.query.criteria.internal.expression;
import java.io.Serializable;
import javax.persistence.criteria.ParameterExpression;
import org.hibernate.query.QueryParameter;
import org.hibernate.query.criteria.internal.CriteriaBuilderImpl;
import org.hibernate.query.criteria.internal.ParameterRegistry;
import org.hibernate.query.criteria.internal.compile.ExplicitParameterInfo;
import org.hibernate.query.criteria.internal.compile.RenderingContext;
import org.hibernate.type.Type;
/**
* Defines a parameter specification, or the information about a parameter (where it occurs, what is
@ -24,41 +22,34 @@ import org.hibernate.type.Type;
*/
public class ParameterExpressionImpl<T>
extends ExpressionImpl<T>
implements ParameterExpression<T>, QueryParameter<T>, Serializable {
implements ParameterExpression<T>, Serializable {
private final String name;
private final Integer position;
private final Type expectedType;
public ParameterExpressionImpl(
CriteriaBuilderImpl criteriaBuilder,
Class<T> javaType,
String name,
Type expectedType) {
String name) {
super( criteriaBuilder, javaType );
this.name = name;
this.position = null;
this.expectedType = expectedType;
}
public ParameterExpressionImpl(
CriteriaBuilderImpl criteriaBuilder,
Class<T> javaType,
Integer position,
Type expectedType) {
Integer position) {
super( criteriaBuilder, javaType );
this.name = null;
this.position = position;
this.expectedType = expectedType;
}
public ParameterExpressionImpl(
CriteriaBuilderImpl criteriaBuilder,
Class<T> javaType,
Type expectedType) {
Class<T> javaType) {
super( criteriaBuilder, javaType );
this.name = null;
this.position = null;
this.expectedType = expectedType;
}
public String getName() {
@ -85,14 +76,4 @@ public class ParameterExpressionImpl<T>
public String renderProjection(RenderingContext renderingContext) {
return render( renderingContext );
}
@Override
public Type getType() {
return expectedType;
}
@Override
public boolean isJpaPositionalParameter() {
return true;
}
}