-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Make H2SequenceMaxValueIncrementer
compatible with H2 database 2.0.x
#27870
Conversation
…both 1.4 and 2.0 of H2
The build failed with
I don't think this is related to my changes. |
...rc/main/java/org/springframework/jdbc/support/incrementer/H2SequenceMaxValueIncrementer.java
Outdated
Show resolved
Hide resolved
H2SequenceMaxValueIncrementer
compatible with version 2.0.x of the H2 database
H2SequenceMaxValueIncrementer
compatible with version 2.0.x of the H2 databaseH2SequenceMaxValueIncrementer
compatible with H2 database 2.0.x
Hi @hpoettker, Thanks for submitting your first PR to the Spring Framework, and thanks for the detailed description! 👍
Thanks for checking both versions.
It's better to have a dedicated integration test using a real, embedded database for this purpose. The H2 documentation for Sequence value expression indeed states that we should be using As mentioned elsewhere, the syntax |
This will be addressed in the following PR for So, for the time being we cannot fully upgrade to H2 2.x in the build. |
Commit ed4e228 introduced support for H2 2.0.x but did not upgrade the H2 dependency. This commit upgrades the H2 dependency to version 2.0.206 but also adds an explicit test dependency on version 1.4.200 in spring-r2dbc, since r2dbc-h2 does not yet support H2 2.0.x. Once r2dbc/r2dbc-h2#204 has been included in a released version of r2dbc-h2 we will be able to upgrade spring-r2dbc's test dependency on the H2 database to 2.0.x as well. See spring-projectsgh-27870 See spring-projectsgh-27902
@hpoettker made me aware of the ModeEnum in H2 that allows the parameterized test to be simplified, which was the primary impetus for this commit. See gh-27870
Spring JDBC is currently not compatible with 2.0.x of H2. This creates problems for users that want to upgrade. See e.g.
I've adjusted
H2SequenceMaxValueIncrementer
such that it works with both 1.4 and 2.0 and adjusted some test DDL scripts such that they work with both H2 versions and HSQL.I've also written a test for the incrementer as it is currently seems not to be covered by any test. I was uncertain whether it should be added to
DataFieldMaxValueIncrementerTests
as that class uses mocks for all data sources instead of embedded databases.The complete build is successful for the currently used H2 version 1.4.200. With version 2.0.204, the tests in
spring-jdbc
andspring-test
also pass. However, the tests inspring-r2dbc
fail with 2.0.204. But that is not related to the changes in the test DDL scripts.