-
Bug
-
Resolution: Unresolved
-
Major
-
8.0 Update 4.1
-
False
-
None
-
False
-
-
-
-
-
-
+
-
Workaround Exists
-
-
-
-
The customer faces NullPointerException issue when setting null value as parameter to Query.setParameter() after migrating their Java EE application running on JBoss EAP 7.4.x (Hibernate 5.3.x) to Jakarta EE application running on JBoss EAP 8.0.x (Hibernate 6.2.x).
Note that this NPE issue does not happen with JBoss EAP 7.4.x (Hibernate 5.3.x).
java.lang.NullPointerException: Cannot invoke "org.hibernate.query.BindableType.resolveExpressible(org.hibernate.engine.spi.SessionFactoryImplementor)" because "declaredParameterType" is null at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.internal.BindingTypeHelper.resolveTemporalPrecision(BindingTypeHelper.java:44) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.internal.QueryParameterBindingImpl.setExplicitTemporalPrecision(QueryParameterBindingImpl.java:295) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.internal.QueryParameterBindingImpl.setBindValue(QueryParameterBindingImpl.java:240) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.spi.AbstractCommonQueryContract.setParameter(AbstractCommonQueryContract.java:1092) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.spi.AbstractSelectionQuery.setParameter(AbstractSelectionQuery.java:882) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.spi.AbstractQuery.setParameter(AbstractQuery.java:607) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.sql.internal.NativeQueryImpl.setParameter(NativeQueryImpl.java:1311) at org.hibernate@6.2.31.Final-redhat-00002//org.hibernate.query.sql.internal.NativeQueryImpl.setParameter(NativeQueryImpl.java:111) at org.jboss.as.jpa@8.0.6.SP1-redhat-00001//org.jboss.as.jpa.container.QueryNonTxInvocationDetacher.setParameter(QueryNonTxInvocationDetacher.java:166) ...(snip)...
The NPE happens when setting null value as parameter to Query.setParameter() with TemporalType parameter (= the following methods of jakarta.persistence.Query API:
- setParameter(int position, Calendar value, TemporalType temporalType)
- setParameter(int position, Date value, TemporalType temporalType)
- setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
- setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
- setParameter(String name, Calendar value, TemporalType temporalType)
- setParameter(String name, Date value, TemporalType temporalType)
Note that NPE does NOT happen when setting null value as parameter Query.setParameter() without TemporalType parameter (= the following methods of jakarta.persistence.Query API):
- setParameter(int position, Object value)
- setParameter(String name, Object value)
- setParameter(Parameter<T> param, T value)
A minimum example code that can reproduce the NPE issue is like the following:
Query query = em.createNativeQuery("update Member set timeStamp = ? where id= ?"); Date value = null; Long id = 1L; query.setParameter(1, value, TemporalType.TIMESTAMP); // <-- NPE happens here query.setParameter(2, id); int res = query.executeUpdate();
- is incorporated by
-
JBEAP-28846 (8.0.z) Upgrade Hibernate from 6.2.32.Final-redhat-00001 to 6.2.33.Final-redhat-00001
- New
- is related to
-
HHH-17151 Loading...
- links to