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 99import org .hibernate .engine .spi .SharedSessionContractImplementor ;
1010import org .hibernate .query .spi .QueryParameterImplementor ;
1111import org .hibernate .query .sqm .tree .expression .JpaCriteriaParameter ;
12+ import org .hibernate .query .sqm .tree .expression .ValueBindJpaCriteriaParameter ;
1213import org .hibernate .type .BindableType ;
1314import org .hibernate .query .KeyedPage ;
1415import org .hibernate .query .KeyedResultList ;
@@ -149,15 +150,12 @@ protected static void bindValueBindCriteriaParameters(
149150 if ( sqmParameter instanceof SqmJpaCriteriaParameterWrapper <?> wrapper ) {
150151 @ SuppressWarnings ("unchecked" )
151152 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 <?> ) {
156154 // Use the anticipated type for binding the value if possible
157155 //noinspection unchecked
158156 final var parameter = (QueryParameterImplementor <Object >) entry .getKey ();
159157 bindings .getBinding ( parameter )
160- .setBindValue ( value , criteriaParameter .getAnticipatedType () );
158+ .setBindValue ( criteriaParameter . getValue () , criteriaParameter .getAnticipatedType () );
161159 }
162160 }
163161 }
Original file line number Diff line number Diff line change @@ -2146,7 +2146,10 @@ else if ( value instanceof SqmExpression<?> ) {
21462146 }
21472147
21482148 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 ) {
21502153 return expressible .getExpressibleJavaType ().isInstance ( value );
21512154 }
21522155 else {
You can’t perform that action at this time.
0 commit comments