Skip to content

[WIP] Change timestamps type to OffsetDateTime in Job/Step Execution #4209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

fmbenhassine
Copy link
Contributor

This is an attempt to change the data type of startTime, endTime, createTime and lastUpdated in JobExecution and StepExecution to OffsetDateTime, which corresponds to the SQL type TIMESTAMP WITH TIME ZONE.

However, the type TIMESTAMP WITH TIME ZONE does not seem to be supported by some databases (or their drivers). Here is a quick list of issues related to this change:

MySQL:

Unsupported SQL type: TIMESTAMP_WITH_TIMEZONE

At JdbcJobExecutionDao (L173 as of 2b258d1)

getJdbcTemplate().update(getQuery(SAVE_JOB_EXECUTION), parameters,
   new int[] { Types.BIGINT, Types.BIGINT, Types.TIMESTAMP_WITH_TIMEZONE,
   Types.TIMESTAMP_WITH_TIMEZONE, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
   Types.INTEGER, Types.TIMESTAMP_WITH_TIMEZONE, Types.TIMESTAMP_WITH_TIMEZONE });

DB2:

[jcc][1091][10417][4.31.10] Invalid data conversion: Parameter instance 2022-10-11T15:21:26.905406+02:00 is invalid for the requested conversion. ERRORCODE=-4461, SQLSTATE=42815

Derby:

ERROR 22005: An attempt was made to get a data value of type 'TIMESTAMP' from a data value of type '2014'.

Adding custom code for specific DB providers in various DAOs is not an option for the time being.

For all these reasons, it was decided to defer the implementation of this feature to a future release.

Issue #1014

This is an attempt to change the data type of startTime, endTime,
createTime and lastUpdated in JobExecution and StepExecution to
OffsetDateTime, which corresponds to the SQL type TIMESTAMP WITH TIME ZONE.

However, the type `TIMESTAMP WITH TIME ZONE` does not seem to be supported
by some databases (or their drivers). Here is a quick list of issues related
to this change:

### MySQL:

```
Unsupported SQL type: TIMESTAMP_WITH_TIMEZONE
```

At `JdbcJobExecutionDao` (L173 as of 2b258d1)

```
getJdbcTemplate().update(getQuery(SAVE_JOB_EXECUTION), parameters,
   new int[] { Types.BIGINT, Types.BIGINT, Types.TIMESTAMP_WITH_TIMEZONE,
   Types.TIMESTAMP_WITH_TIMEZONE, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
   Types.INTEGER, Types.TIMESTAMP_WITH_TIMEZONE, Types.TIMESTAMP_WITH_TIMEZONE });
```

### DB2:

```
[jcc][1091][10417][4.31.10] Invalid data conversion: Parameter instance 2022-10-11T15:21:26.905406+02:00 is invalid for the requested conversion. ERRORCODE=-4461, SQLSTATE=42815
```

### Derby:

```
ERROR 22005: An attempt was made to get a data value of type 'TIMESTAMP' from a data value of type '2014'.
```

---

Adding custom code for specific DB providers in various DAOs is not an option
for the time being.

For all these reasons, it was decided to defer the implementation of this
feature to future release.

Issue spring-projects#1014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant