| We are having the same problem with our application and this bug prevent us from migrating to the current 5.2.x version. A short rundown what happens: query.setParameter(String name, Date value, TemporalType temporalType) calls after some steps setBindValue(T value, TemporalType clarifiedTemporalType) from QueryParameterBindingImpl.java hibernate-core/src/main/java/org/hibernate/query/internal/QueryParameterBindingImpl.java public void setBindValue(T value, TemporalType clarifiedTemporalType) with value = java.util.Date() object clarifiedTemporalType = TemporalType.DATE 1. calls private void bindValue(T value) 2. sets this.bindType = org.hibernate.type.TimestampType 3. calls BindingTypeHelper.INSTANCE.determineTypeForTemporalType( clarifiedTemporalType, bindType, value ) hibernate-core/src/main/java/org/hibernate/query/internal/BindingTypeHelper.java public BasicType determineTypeForTemporalType(TemporalType temporalType, Type baseType, Object bindValue) with temporalType = TemporalType.DATE baseType = org.hibernate.type.TimestampType bindValue = java.util.Date() object 1. sets javaType = java.util.Date.class 2. switch for temporalType jumps to case DATE 3. calls resolveDateTemporalTypeVariant( javaType, baseType ) public BasicType resolveDateTemporalTypeVariant(Class javaType, Type baseType) with javaType = java.util.Date.class baseType = org.hibernate.type.TimestampType lines 122-124 just return the baseType (org.hibernate.type.TimestampType) derived from the value, completely ignoring the temporalType (TemporalType.DATE) Result (in our case): for a DATE column on the DB, the set date representation for the parameter causes an Exception because of the wrong format. |