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 8
8
import org .hibernate .HibernateException ;
9
9
import org .hibernate .engine .spi .SharedSessionContractImplementor ;
10
10
import org .hibernate .graph .spi .AppliedGraph ;
11
+ import org .hibernate .query .sqm .tree .expression .ValueBindJpaCriteriaParameter ;
11
12
import org .hibernate .type .BindableType ;
12
13
import org .hibernate .query .IllegalSelectQueryException ;
13
14
import org .hibernate .query .KeyedPage ;
@@ -158,14 +159,11 @@ else if ( bindType != null ) {
158
159
159
160
protected <T > void bindCriteriaParameter (SqmJpaCriteriaParameterWrapper <T > sqmParameter ) {
160
161
final JpaCriteriaParameter <T > criteriaParameter = sqmParameter .getJpaCriteriaParameter ();
161
- final T value = criteriaParameter .getValue ();
162
- // We don't set a null value, unless the type is also null which
163
- // is the case when using HibernateCriteriaBuilder.value
164
- if ( value != null || criteriaParameter .getNodeType () == null ) {
162
+ if ( criteriaParameter .getNodeType () instanceof ValueBindJpaCriteriaParameter <?> ) {
165
163
// Use the anticipated type for binding the value if possible
166
164
getQueryParameterBindings ()
167
165
.getBinding ( criteriaParameter )
168
- .setBindValue ( value , criteriaParameter .getAnticipatedType () );
166
+ .setBindValue ( criteriaParameter . getValue () , criteriaParameter .getAnticipatedType () );
169
167
}
170
168
}
171
169
Original file line number Diff line number Diff line change @@ -2147,7 +2147,10 @@ else if ( value instanceof SqmExpression<?> ) {
2147
2147
}
2148
2148
2149
2149
private <T > boolean isInstance (BindableType <? extends T > bindableType , T value ) {
2150
- if ( bindableType instanceof SqmExpressible <?> expressible ) {
2150
+ if ( value == null ) {
2151
+ return true ;
2152
+ }
2153
+ else if ( bindableType instanceof SqmExpressible <?> expressible ) {
2151
2154
return expressible .getExpressibleJavaType ().isInstance ( value );
2152
2155
}
2153
2156
else {
You can’t perform that action at this time.
0 commit comments