deps: update dependency org.mybatis.dynamic-sql:mybatis-dynamic-sql to v2#2419
Open
renovate-bot wants to merge 1 commit intogoogleapis:mainfrom
Open
Conversation
|
/gcbrun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.5.2→2.0.0Release Notes
mybatis/mybatis-dynamic-sql (org.mybatis.dynamic-sql:mybatis-dynamic-sql)
v2.0.0Release 2.0.0 is a significant milestone for the library with many enhancements and changes. We have moved to Java 17
as the minimum version supported. If you are unable to move to this version of Java then the releases in the 1.x line
can be used with Java 8.
We have taken the opportunity to make changes to the library that may break existing code. We have
worked to make these changes as minimal as possible.
Please read these release notes carefully as there are changes that may impact many users.
DSL Updates and Migration Plan
With this release, I have started a long-term plan to update the DSLs that have "where" clauses – namely, CountDSL,
DeleteDSL, SelectDSL, and UpdateDSL. All of these DSLs are generic and allow you to specify a function
that can modify the model created when invoking
build(). I now view this as a design flaw that provides verylittle benefit and makes direct use of a DSL more complex. For example, direct usage of a DSL often requires declaring
a variable like
DeleteDSL<DeleteModel>instead of simplyDeleteDSL. This gets worse when you have more complexsituations involving DSL inner classes.
Another issue is the tight coupling between
SelectDSLandQueryExpressionDSL. It is confusing to have theselectmethod actually return
QueryExpressionDSL<SelectModel>.So this release includes new, non-generic, versions of the DSLs in a new package structure. The new DSLs will live
side by side with the old DSLs for now to maintain backwards compatibility. Eventually, the old DSls will be removed.
Here is the migration plan:
transparent to Kotlin users as all the prior complexity was hidden by the Kotlin DSLs.
versions.
SqlBuilderto use the new DSLs. In many cases you will be able to update to the new DSL by simply changing apackage name.
I expect these next releases to be a relatively fast follow after the 2.0.0 release.
This table shows the old and new versions of the DSLs:
org.mybatis.dynamic.sql.dsl.CountDSLorg.mybatis.dynamic.sql.select.CountDSLorg.mybatis.dynamic.sql.dsl.DeleteDSLorg.mybatis.dynamic.sql.delete.DeleteDSLorg.mybatis.dynamic.sql.dsl.SelectDSLorg.mybatis.dynamic.sql.select.SelectDSLandorg.mybatis.dynamic.sql.select.QueryExpressionDSLorg.mybatis.dynamic.sql.dsl.UpdateDSLorg.mybatis.dynamic.sql.update.UpdateDSLThe "completer" classes are also impacted and will need to change. This table shows the old and new versions:
org.mybatis.dynamic.sql.dsl.CountDSLCompleterorg.mybatis.dynamic.sql.select.CountDSLCompleterorg.mybatis.dynamic.sql.dsl.DeleteDSLCompleterorg.mybatis.dynamic.sql.delete.DeleteDSLCompleterorg.mybatis.dynamic.sql.dsl.SelectDSLCompleterorg.mybatis.dynamic.sql.select.SelectDSLCompleterorg.mybatis.dynamic.sql.dsl.UpdateDSLCompleterorg.mybatis.dynamic.sql.update.UpdateDSLCompleterIf you are actually using the generic function in the old DSLs to alter the model class produced by a DSL, then you can
replace it with the new
mapmethod on all affected model classes to achieve the same result.If you are using the DSLs directly (for example, not with code generated by MyBatis Generator), I encourage you to
update your code to use the new DSLs now. As always, if you experience any difficulties with this new version of the
library or in migrating to the new DSLs, please let us know by opening an issue on GitHub.
Other Important Changes:
InvalidSqlExceptionduring rendering if the list of values is empty. Previouslyan empty In condition would render as invalid SQL and would usually cause a runtime exception from the database.
With this change, the exception thrown is more predictable and the error is caught before sending the SQL to the
database.
rendering if a null value is passed in
is deprecated and will be removed in a future release.
these concepts for different databases it simply adds known clauses to a generated SQL statement. You should always
test to make sure these functions work in your target database. Currently, we support and test the options
supported by PostgreSQL.
have coded a direct implementation of
VisitableCondition. The change makes it easier to code custom conditions thatare not supported by the library out of the box. The statement renderers now call methods
renderConditionandrenderLeftColumnthat you can override to implement any rendering you need. In addition, we've madefilterandmapsupport optional if you implement custom conditionsSqlColumn. This property name can beused with the record-based insert methods to reduce the boilerplate code for mapping columns to Java properties.
Potentially Breaking Changes:
refactored that support to be more flexible. Please see the
Spring Batch documentation page to see the new usage
details.
SortSpecification, you will need to update thoseimplementations due to a new rendering strategy for ORDER BY phrases. The old methods
isDescendingandorderByNameare removed in favor of a new method
renderForOrderByhold an instance of
BasicColumnrather thanBindableColumn. This change was made to make the functions moreuseful in a variety of circumstances. If you follow the patterns shown on the
Extending the Library page, the change should be
limited to changing the private constructor to accept
BasicColumnrather thanBindableColumn.library. The idea was to build where clauses that would render and could then be inserted into hand-coded SQL.
As far as I know, this was only used for some internal testing. If you have a use case for this feature, please
let us know and we will revisit this decision.
Adoption of JSpecify (https://jspecify.dev/)
Following the lead of many other projects (including The Spring Framework), we have adopted JSpecify to fully
document the null handling properties of this library. JSpecify is now a runtime dependency – as is
recommended practice with JSpecify.
This change should not impact the running of any existing code, but depending on your usage, you may see new IDE or
tooling warnings based on the declared nullability of methods in the library. You may choose to ignore the
warnings, and things should continue to function. Of course, we recommend that you do not ignore these warnings!
In general, the library does not expect that you will pass a null value into any method. There are two exceptions to
this rule:
use of java.util.Optional
(for example, "isEqualToWhenPresent")
As you might expect, standardizing null handling revealed some issues in the library that may impact you.
Fixing compiler warnings and errors:
We expect that most of the warnings you encounter will be related to passing null values into a where condition.
These warnings should be resolved by changing your code to use the "WhenPresent" versions of methods as those
methods handle null values predictably.
Java Classes that extend "AliasableSqlTable" will likely see IDE warnings about non-null type arguments. This can be
resolved by adding a "@NullMarked" annotation to the class or package. This issue does not affect Kotlin classes
that extend "AliasableSqlTable".
Similarly, if you have coded any functions for use with your queries, you can resolve most IDE warnings by adding
the "@NullMarked" annotation.
If you have coded any Kotlin functions that operate on a generic Java class from the library, then you should
change the type parameter definition to specify a non-nullable type. For example...
Should change to:
Runtime behavior changes:
similar to
java.util.Optional. Previously, calling a "value" method of the condition would return null. Nowthose methods will throw
java.util.NoSuchElementException. This should not impact you in normal usage."Converter" interface. The primary change is that the framework will no longer call a type converter if the
input value is null. This should simplify the coding of converters and foster reuse with existing Spring converters.
conditions will now properly handle this outcome
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.