HHH-18575 Fix IllegalStateException while passing multi-valued BigDecimal as parameter
Fix ``` java.lang.IllegalStateException: Binding is multi-valued; illegal call to #getBindValue at org.hibernate.query.internal.QueryParameterBindingImpl.getBindValue(QueryParameterBindingImpl.java:100) at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.resolveSqmParameter(BaseSqmToSqlAstConverter.java:6283) at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeSqmParameter(BaseSqmToSqlAstConverter.java:5861) at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeSingleSqmParameter(BaseSqmToSqlAstConverter.java:5950) at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.processInSingleParameter(BaseSqmToSqlAstConverter.java:8178) at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.processInSingleHqlParameter(BaseSqmToSqlAstConverter.java:8135) at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.processInListWithSingleParameter(BaseSqmToSqlAstConverter.java:8124) ```
This commit is contained in:
parent
1951c0b993
commit
1d46b87008
|
@ -6293,7 +6293,14 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
final QueryParameterBinding<?> binding = domainParameterBindings.getBinding(
|
final QueryParameterBinding<?> binding = domainParameterBindings.getBinding(
|
||||||
domainParameterXref.getQueryParameter( expression )
|
domainParameterXref.getQueryParameter( expression )
|
||||||
);
|
);
|
||||||
final Object bindValue = binding.getBindValue();
|
final Object bindValue;
|
||||||
|
if ( binding.isMultiValued() ) {
|
||||||
|
final Collection<?> bindValues = binding.getBindValues();
|
||||||
|
bindValue = !bindValues.isEmpty() ? bindValues.iterator().next() : null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bindValue = binding.getBindValue();
|
||||||
|
}
|
||||||
if ( bindValue != null ) {
|
if ( bindValue != null ) {
|
||||||
if ( bindValue instanceof BigInteger ) {
|
if ( bindValue instanceof BigInteger ) {
|
||||||
int precision = bindValue.toString().length() - ( ( (BigInteger) bindValue ).signum() < 0 ? 1 : 0 );
|
int precision = bindValue.toString().length() - ( ( (BigInteger) bindValue ).signum() < 0 ? 1 : 0 );
|
||||||
|
|
Loading…
Reference in New Issue