File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
hibernate-core/src/main/java/org/hibernate/query/sqm/internal Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 9
9
import org .hibernate .engine .spi .SharedSessionContractImplementor ;
10
10
import org .hibernate .query .spi .QueryParameterImplementor ;
11
11
import org .hibernate .query .sqm .tree .expression .JpaCriteriaParameter ;
12
+ import org .hibernate .query .sqm .tree .expression .ValueBindJpaCriteriaParameter ;
12
13
import org .hibernate .type .BindableType ;
13
14
import org .hibernate .query .KeyedPage ;
14
15
import org .hibernate .query .KeyedResultList ;
@@ -149,15 +150,12 @@ protected static void bindValueBindCriteriaParameters(
149
150
if ( sqmParameter instanceof SqmJpaCriteriaParameterWrapper <?> wrapper ) {
150
151
@ SuppressWarnings ("unchecked" )
151
152
final var criteriaParameter = (JpaCriteriaParameter <Object >) wrapper .getJpaCriteriaParameter ();
152
- final var value = criteriaParameter .getValue ();
153
- // We don't set a null value, unless the type is also null which
154
- // is the case when using HibernateCriteriaBuilder.value
155
- if ( value != null || criteriaParameter .getNodeType () == null ) {
153
+ if ( criteriaParameter instanceof ValueBindJpaCriteriaParameter <?> ) {
156
154
// Use the anticipated type for binding the value if possible
157
155
//noinspection unchecked
158
156
final var parameter = (QueryParameterImplementor <Object >) entry .getKey ();
159
157
bindings .getBinding ( parameter )
160
- .setBindValue ( value , criteriaParameter .getAnticipatedType () );
158
+ .setBindValue ( criteriaParameter . getValue () , criteriaParameter .getAnticipatedType () );
161
159
}
162
160
}
163
161
}
Original file line number Diff line number Diff line change @@ -2146,7 +2146,10 @@ else if ( value instanceof SqmExpression<?> ) {
2146
2146
}
2147
2147
2148
2148
private <T > boolean isInstance (BindableType <? extends T > bindableType , T value ) {
2149
- if ( bindableType instanceof SqmExpressible <?> expressible ) {
2149
+ if ( value == null ) {
2150
+ return true ;
2151
+ }
2152
+ else if ( bindableType instanceof SqmExpressible <?> expressible ) {
2150
2153
return expressible .getExpressibleJavaType ().isInstance ( value );
2151
2154
}
2152
2155
else {
You can’t perform that action at this time.
0 commit comments