-
Notifications
You must be signed in to change notification settings - Fork 358
Do not convert from LocalDateTime to Timestamp by default. #985
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
Conversation
Most supported databases don't need that conversion. Db2 does need it and gets it through JdbcDb2Dialect. As part of the effort it became obvious that the filtering for conversions between Date and JSR310 data types was broken. It is fixed now, which required a dedicated reading conversion from LocalDateTime to Date for JdbcMySqlDialect. Closes #974
private static final StoreConversions STORE_CONVERSIONS = StoreConversions.of(JdbcSimpleTypes.HOLDER, | ||
STORE_CONVERTERS); | ||
|
||
private static final Predicate<ConvertiblePair> excludeConversionsBetweenDateAndJsr310Types= cp -> !isDateTimeApiConversion(cp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rewrite this into a method-reference form?
* | ||
* @since 2.3 | ||
*/ | ||
public JdbcCustomConversions(StoreConversions storeConversions, List<?> userConverters) { | ||
super(new ConverterConfiguration(storeConversions, userConverters, JdbcCustomConversions::isDateTimeApiConversion)); | ||
super(new ConverterConfiguration(storeConversions, userConverters, cp -> !isDateTimeApiConversion(cp))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this reuse excludeConversionsBetweenDateAndJsr310Types
?
JdbcCustomConversions customConversions = new JdbcCustomConversions( | ||
(List<?>) new JdbcMySqlDialect().getConverters()); | ||
|
||
SoftAssertions.assertSoftly(softly -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stick to static imports for AssertJ.
Use static import for `SoftAssertions.assertSoftly` everywhere. Polishing of the conversion filter. See #974
Most supported databases don't need that conversion. Db2 does need it and gets it through JdbcDb2Dialect. As part of the effort it became obvious that the filtering for conversions between Date and JSR310 data types was broken. It is fixed now, which required a dedicated reading conversion from LocalDateTime to Date for JdbcMySqlDialect. Closes #974 Original pull request: #985.
That's merged now. |
Most supported databases don't need that conversion.
Db2 does need it and gets it through
JdbcDb2Dialect
.As part of the effort it became obvious that the filtering for conversions between
Date
and JSR310 data types was broken.It is fixed now, which required a dedicated reading conversion from
LocalDateTime
toDate
forJdbcMySqlDialect
.Closes #974
Please review the part about filtering conversions especially carefully. After looking at the git history for some time I was rather confused.