Skip to content

Commit 32fb3f7

Browse files
committed
Remove QueryExpressionDSL and SelectDSL Generics
1 parent 1d7e02b commit 32fb3f7

File tree

19 files changed

+732
-759
lines changed

19 files changed

+732
-759
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ you are unable to move to this version of Java then the releases in the 1.x line
1010
In addition, we have taken the opportunity to make changes to the library that may break existing code. We have
1111
worked to make these changes as minimal as possible.
1212

13+
### Breaking Changes:
14+
15+
We have removed the generic type parameters from DeleteDSL, CountDSL, QueryExpressionDSL, SelectDSL, and UpdateDSL.
16+
We have also removed the adapter function arguments that could be passed into the DSLs.
17+
The generics added quite a lot of complexity for very little value. They were inconsistently applied, not available
18+
in the Kotlin DSLs, etc. Unfortunately, there was no way to do this without introducing breaking changes.
19+
20+
1. If you are a user of MyBatis Generator, then Java mappers generated prior to this release will have errors
21+
related to UpdateDSL. The solution is simply to change `UpdateDSL<UpdateModel>` to `UpdateDSL`. MyBatis
22+
Generator will be updated so that it generates code without errors.
23+
2. Anywhere you have code that declares variables with the generic type parameter, you will need to remove the
24+
type parameter.
25+
3. If you had had written any code that actually made use of the generic function (through the use of an adapter
26+
function passed into the DSL constructor) then you will need to rewrite that code. See the code in the test
27+
package `examples.paging` for an example of how we now recommend modifying the generated SQL if there is no other
28+
option available to you in the library.
29+
1330
### Potentially Breaking Changes:
1431

1532
- If you use this library with MyBatis' Spring Batch integration, you will need to make changes as we have

src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,19 @@ static InsertIntoNextStep insertInto(SqlTable table) {
217217
return new InsertIntoNextStep(table);
218218
}
219219

220-
static FromGatherer<SelectModel> select(BasicColumn... selectList) {
220+
static FromGatherer select(BasicColumn... selectList) {
221221
return SelectDSL.select(selectList);
222222
}
223223

224-
static FromGatherer<SelectModel> select(Collection<? extends BasicColumn> selectList) {
224+
static FromGatherer select(Collection<? extends BasicColumn> selectList) {
225225
return SelectDSL.select(selectList);
226226
}
227227

228-
static FromGatherer<SelectModel> selectDistinct(BasicColumn... selectList) {
228+
static FromGatherer selectDistinct(BasicColumn... selectList) {
229229
return SelectDSL.selectDistinct(selectList);
230230
}
231231

232-
static FromGatherer<SelectModel> selectDistinct(Collection<? extends BasicColumn> selectList) {
232+
static FromGatherer selectDistinct(Collection<? extends BasicColumn> selectList) {
233233
return SelectDSL.selectDistinct(selectList);
234234
}
235235

0 commit comments

Comments
 (0)