In my table definition, there is a column with int data type. If a value is “0”, I want jdbcTemplate update method to update this field with “NULL” instead of “0” by default.
this.jdbcTemplate.update("UPDATE GCUR_OBSERVATION "
+ "SET ObserverId = ?," + "ObservationDate = ?,"
+ "PointCuring = ?"
+ " WHERE locationId = ? AND ObservationStatus = 0",
new Object[] { new Integer(newObservation.getObserverId()),
newObservation.getObservationDate(),
new Integer(newObservation.getLocationId()) });
The code snippet above runs well when the Point Curing is not NULL. However, how can it be stored as NULL in the database table?
I hope you are getting NUll Pointer Exception.
Try this
And now pass locId here.