I am facing a blocking issue when saving a step instance/step execution.
Here is the error stack:
Note: I had to change the datatype of LAST_STEP_EXECUTION_ID from BIGINT to NUMBER, as BIGINT datatype does not exist in Oracle9.Code:Caused by: java.sql.SQLException: Invalid column datatype at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269) at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6541) at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1424) at org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:104) at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:154) at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:94) at org.springframework.jdbc.core.ArgPreparedStatementSetter.setValues(ArgPreparedStatementSetter.java:51) at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:742) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:537) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:738) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:796) at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:804) at org.springframework.batch.execution.repository.dao.JdbcStepDao.update(JdbcStepDao.java:623) at org.springframework.batch.execution.repository.SimpleJobRepository.update(SimpleJobRepository.java:279) ... (AOP transaction stuff) at $Proxy10.update(Unknown Source) at org.springframework.batch.execution.step.simple.SimpleStepExecutor.updateStatus(SimpleStepExecutor.java:304) at org.springframework.batch.execution.step.simple.SimpleStepExecutor.execute(SimpleStepExecutor.java:275) at org.springframework.batch.execution.step.simple.SimpleStep.execute(AbstractStep.java:131) at org.springframework.batch.execution.job.simple.SimpleJob.execute(SimpleJob.java:82)
When exploring this issue, I noticed that in SimpleStepExecutor.updateStatus(), the stepInstance is updated before stepExecution is created and is assigned an ID, and therefore, LAST_STEP_EXECUTION_ID is set to null. Maybe the order should be reversed (first save or update step execution, then update step instance) ?
If this cannot be achieved for some reason and we can live with a null LAST_STEP_EXECUTION_ID, JdbcStepDao must use JdbcTemplate.update(String, Object[], int[]) instead of update(String, Object[]), in order to correctly set the datatypes of the parameters. I noticed that this simple change works. Maybe the above is a JdbcTemplate bug, or a JDBC driver bug ?


Reply With Quote