HHH-15142 CriteriaQuery with Like predicate fails when repeated with java.lang.IllegalArgumentException: Parameter value [] did not match expected type [java.lang.String (n/a)]
This commit is contained in:
parent
f1c46277e5
commit
ee3129d45b
|
@ -94,7 +94,7 @@ public class CriteriaCompiler implements Serializable {
|
|||
public ExplicitParameterInfo registerExplicitParameter(ParameterExpression<?> criteriaQueryParameter) {
|
||||
ExplicitParameterInfo parameterInfo = explicitParameterInfoMap.get( criteriaQueryParameter );
|
||||
if ( parameterInfo == null ) {
|
||||
if ( StringHelper.isNotEmpty( criteriaQueryParameter.getName() ) ) {
|
||||
if ( StringHelper.isNotEmpty( criteriaQueryParameter.getName() ) && !( (ParameterExpressionImpl) criteriaQueryParameter ).isNameGenerated() ) {
|
||||
parameterInfo = new ExplicitParameterInfo(
|
||||
criteriaQueryParameter.getName(),
|
||||
null,
|
||||
|
@ -109,9 +109,8 @@ public class CriteriaCompiler implements Serializable {
|
|||
);
|
||||
}
|
||||
else {
|
||||
final String name = generateParameterName();
|
||||
parameterInfo = new ExplicitParameterInfo(
|
||||
name,
|
||||
generateParameterName(),
|
||||
null,
|
||||
criteriaQueryParameter.getJavaType()
|
||||
);
|
||||
|
|
|
@ -25,6 +25,7 @@ public class ParameterExpressionImpl<T>
|
|||
implements ParameterExpression<T>, Serializable {
|
||||
private String name;
|
||||
private final Integer position;
|
||||
private boolean isNameGenerated;
|
||||
|
||||
public ParameterExpressionImpl(
|
||||
CriteriaBuilderImpl criteriaBuilder,
|
||||
|
@ -57,6 +58,10 @@ public class ParameterExpressionImpl<T>
|
|||
return name;
|
||||
}
|
||||
|
||||
public boolean isNameGenerated() {
|
||||
return isNameGenerated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPosition() {
|
||||
return position;
|
||||
|
@ -76,6 +81,7 @@ public class ParameterExpressionImpl<T>
|
|||
public String render(RenderingContext renderingContext) {
|
||||
final ExplicitParameterInfo parameterInfo = renderingContext.registerExplicitParameter( this );
|
||||
if ( name == null && position == null ) {
|
||||
isNameGenerated = true;
|
||||
name = parameterInfo.getName();
|
||||
}
|
||||
return parameterInfo.render();
|
||||
|
|
Loading…
Reference in New Issue