Skip to content

Commit a766306

Browse files
committed
Docs
1 parent 42646b5 commit a766306

File tree

2 files changed

+36
-10
lines changed

2 files changed

+36
-10
lines changed

CHANGELOG.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ This log will detail notable changes to MyBatis Dynamic SQL. Full details are av
44

55
## Release 2.0.0 - Unreleased
66

7-
Significant changes:
7+
Release 2.0.0 is a significant milestone for the library. We have moved to Java 17 as the minimum version supported. If
8+
you are unable to move to this version of Java then the releases in the 1.x line can be used with Java 8.
9+
10+
In addition, we have taken the opportunity to make changes to the library that may break existing code. We have
11+
worked to make these changes as minimal as possible.
12+
13+
**Potentially Breaking Changes:**
14+
15+
- If you have implemented any custom functions, you will likely need to make changes. The supplied base classes now
16+
hold an instance of `BasicColumn` rather than `BindableColumn`. This change was made to make the functions more
17+
useful in variety of circumstances. If you follow the patterns shown on the
18+
[Extending the Library](https://mybatis.org/mybatis-dynamic-sql/docs/extending.html) page, the change should be as
19+
minimal as changing the private constructor to accept `BasicColumn` rather than `BindableColumn`.
20+
21+
Other important changes:
822

923
- The library now requires Java 17
1024
- Deprecated code from prior releases is removed

src/site/markdown/docs/extending.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ The SELECT support is the most complex part of the library, and also the part of
1111
extended. There are two main interfaces involved with extending the SELECT support. Picking which interface to
1212
implement is dependent on how you want to use your extension.
1313

14-
| Interface | Purpose |
15-
|------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
16-
| `org.mybatis.dynamic.sql.BasicColumn` | Use this interface if you want to add capabilities to a SELECT list or a GROUP BY expression. For example, using a database function. |
17-
| `org.mybatis.dynamic.sql.BindableColumn` | Use this interface if you want to add capabilities to a WHERE clause. For example, creating a custom condition. |
14+
| Interface | Purpose |
15+
|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
16+
| `org.mybatis.dynamic.sql.BasicColumn` | Use this interface if you want to add capabilities to a SELECT list, a GROUP BY, or an ORDER BY expression. For example, using a database function. |
17+
| `org.mybatis.dynamic.sql.BindableColumn` | Use this interface if you want to add capabilities to a WHERE clause in addition to the capabilities of `BasicColumn`. For example, creating a custom condition. |
1818

1919
Rendering is the process of generating an appropriate SQL fragment to implement the function or calculated column.
2020
The library will call a method `render(RenderingContext)` in your implementation. This method should return an
@@ -101,14 +101,15 @@ the function changes the data type from `byte[]` to `String`.
101101
import java.sql.JDBCType;
102102
import java.util.Optional;
103103

104+
import org.mybatis.dynamic.sql.BasicColumn;
104105
import org.mybatis.dynamic.sql.BindableColumn;
105106
import org.mybatis.dynamic.sql.render.RenderingContext;
106107
import org.mybatis.dynamic.sql.select.function.AbstractTypeConvertingFunction;
107108
import org.mybatis.dynamic.sql.util.FragmentAndParameters;
108109

109110
public class ToBase64 extends AbstractTypeConvertingFunction<byte[], String, ToBase64> {
110111

111-
protected ToBase64(BindableColumn<byte[]> column) {
112+
private ToBase64(BasicColumn column) {
112113
super(column);
113114
}
114115

@@ -143,13 +144,15 @@ public class ToBase64 extends AbstractTypeConvertingFunction<byte[], String, ToB
143144
The following function implements the common database `UPPER()` function.
144145

145146
```java
147+
import org.mybatis.dynamic.sql.BasicColumn;
148+
import org.mybatis.dynamic.sql.BindableColumn;
146149
import org.mybatis.dynamic.sql.render.RenderingContext;
147150
import org.mybatis.dynamic.sql.select.function.AbstractUniTypeFunction;
148151
import org.mybatis.dynamic.sql.util.FragmentAndParameters;
149152

150153
public class Upper extends AbstractUniTypeFunction<String, Upper> {
151154

152-
private Upper(BindableColumn<String> column) {
155+
private Upper(BasicColumn column) {
153156
super(column);
154157
}
155158

@@ -178,19 +181,21 @@ Note that `FragmentAndParameters` has a utility method that can simplify the imp
178181
add any new parameters to the resulting fragment. For example, the UPPER function can be simplified as follows:
179182

180183
```java
184+
import org.mybatis.dynamic.sql.BasicColumn;
185+
import org.mybatis.dynamic.sql.BindableColumn;
181186
import org.mybatis.dynamic.sql.render.RenderingContext;
182187
import org.mybatis.dynamic.sql.select.function.AbstractUniTypeFunction;
183188
import org.mybatis.dynamic.sql.util.FragmentAndParameters;
184189

185190
public class Upper extends AbstractUniTypeFunction<String, Upper> {
186191

187-
private Upper(BindableColumn<String> column) {
192+
private Upper(BasicColumn column) {
188193
super(column);
189194
}
190195

191196
@Override
192197
public FragmentAndParameters render(RenderingContext renderingContext) {
193-
return = column.render(renderingContext).mapFragment(f -> "upper(" + f + ")"); //$NON-NLS-1$ //$NON-NLS-2$
198+
return column.render(renderingContext).mapFragment(f -> "upper(" + f + ")"); //$NON-NLS-1$ //$NON-NLS-2$
194199
}
195200

196201
@Override
@@ -211,9 +216,16 @@ The following function implements the concatenate operator. Note that the operat
211216
arbitrary length:
212217

213218
```java
219+
import java.util.Arrays;
220+
import java.util.List;
221+
222+
import org.mybatis.dynamic.sql.BasicColumn;
223+
import org.mybatis.dynamic.sql.BindableColumn;
224+
import org.mybatis.dynamic.sql.select.function.OperatorFunction;
225+
214226
public class Concatenate<T> extends OperatorFunction<T> {
215227

216-
protected Concatenate(BindableColumn<T> firstColumn, BasicColumn secondColumn,
228+
protected Concatenate(BasicColumn firstColumn, BasicColumn secondColumn,
217229
List<BasicColumn> subsequentColumns) {
218230
super("||", firstColumn, secondColumn, subsequentColumns); //$NON-NLS-1$
219231
}

0 commit comments

Comments
 (0)