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 88import org .hibernate .HibernateException ;
99import org .hibernate .engine .spi .SharedSessionContractImplementor ;
1010import org .hibernate .graph .spi .AppliedGraph ;
11+ import org .hibernate .query .sqm .tree .expression .ValueBindJpaCriteriaParameter ;
1112import org .hibernate .type .BindableType ;
1213import org .hibernate .query .IllegalSelectQueryException ;
1314import org .hibernate .query .KeyedPage ;
@@ -158,14 +159,11 @@ else if ( bindType != null ) {
158159
159160 protected <T > void bindCriteriaParameter (SqmJpaCriteriaParameterWrapper <T > sqmParameter ) {
160161 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 instanceof ValueBindJpaCriteriaParameter <?> ) {
165163 // Use the anticipated type for binding the value if possible
166164 getQueryParameterBindings ()
167165 .getBinding ( criteriaParameter )
168- .setBindValue ( value , criteriaParameter .getAnticipatedType () );
166+ .setBindValue ( criteriaParameter . getValue () , criteriaParameter .getAnticipatedType () );
169167 }
170168 }
171169
Original file line number Diff line number Diff line change @@ -2147,7 +2147,10 @@ else if ( value instanceof SqmExpression<?> ) {
21472147 }
21482148
21492149 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 ) {
21512154 return expressible .getExpressibleJavaType ().isInstance ( value );
21522155 }
21532156 else {
You can’t perform that action at this time.
0 commit comments