You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I copied the old class and stored a copy in my project and wired it up via
@Bean
ConfigurationCustomizer mybatisConfigurationCustomizer(@Value("${cms.mybatis.cache.enabled:#{false}}") boolean isCacheEnabled) {
return configuration -> {
configuration.setCacheEnabled(isCacheEnabled);
// For some reason the built in OffsetDateTimeTypeHandler doesn't work like it did in the guice module
configuration.getTypeHandlerRegistry()
.register(OffsetDateTime.class, new OffsetDateTimeTypeHandler());
};
}
}
The text was updated successfully, but these errors were encountered:
It's not a bug.
From Java point of view, the expected behavior would be...
When you persist a OffsetDateTime, the offset information should be stored in the database as well (even if it's different from the system's offset).
When you persist a OffsetDateTime instance and then retrieve it, the returned OffsetDateTime should have the same offset as the inserted one (even when it's different from the system's offset).
The new implementation satisfies these conditions, but it requires the database to support storing offset information and MySQL does not support it (see #1368 (comment)).
The old implementation didn't satisfy both 1 and 2, but it may have seemed to satisfy 2 if you always used the default offset (i.e. ZoneOffset.systemDefault()).
The current workaround is to copy the old implementation to your project and register it in the config.
Please let us know if you need further assistance.
(You already did this. Forgot to edit the template :))
Java Version
OpenJdk 11.0.2
MyBatis version
3.5.3
Database vendor and version
MySql 5.7
Description
I am upgrading
FROM
TO
During that process I noticed that that the OffsetDateTimeTypeHandler seemed to have a breaking change, and or maybe a bug.
https://github.com/mybatis/mybatis-3/blob/mybatis-3.4.6/src/main/java/org/apache/ibatis/type/OffsetDateTimeTypeHandler.java
vs
https://github.com/mybatis/mybatis-3/blob/mybatis-3.5.3/src/main/java/org/apache/ibatis/type/OffsetDateTimeTypeHandler.java
It seems internal logic for handling the serialization and deserialization has been removed.
Expected result
Actual result
Workaround
I copied the old class and stored a copy in my project and wired it up via
The text was updated successfully, but these errors were encountered: