-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Support Java 8 Dates in Job and Step Execution [BATCH-2590] #1014
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
Comments
Yep +1 here. And also consider changing the job parameter types to be java8 Date Time API. |
@benas - When Spring Batch 5.0.0 will be ready? |
@javaHelper It depends on the release date of SF 6, but it is expected for the upcoming Fall. |
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
While evaluating the change of timestamp fields to For this reason, we have decided to change the type from |
@fmbenhassine |
It's off-topic, but is there any rationale to exclude |
It's there? new JobParametersBuilder()
.addLocalDateTime(Config.JOB_PARAMETER_NAME_TO_DATE, LocalDateTime.now()) |
@davidkarlsen Sorry, I was using spring boot 2. I checked it from code. |
Philippe Marschall opened BATCH-2590 and commented
Currently all timestamps on
JobExecution
andStepExecution
are of typejava.util.Date
. It would be cool if instead they could be directly a Java 8 Date Time API type,OffsetDateTime
andZonedDateTime
are obvious candidates.Ideally the data type of the corresponding database would be changed from
TIMESTAMP
toTIMESTAMP WITH TIME ZONE
as well.No further details from BATCH-2590
The text was updated successfully, but these errors were encountered: