Skip to content

Commit f31473c

Browse files
committed
Docs
1 parent 4984924 commit f31473c

File tree

1 file changed

+15
-35
lines changed

1 file changed

+15
-35
lines changed
Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,21 @@
11
# V1 to V2 Migration Guide
22

3-
Version 2 of MyBatis Dynamic SQL introduced many new features. This page will document how to migrate code
4-
from prior releases to version 2.
3+
Version 2 of MyBatis Dynamic SQL introduced many new features. On this page we will provide examples for the more
4+
significant changes - changes that are more substantial than following deprecation messages.
55

6-
## Java Join Syntax
7-
8-
Version2 offers a fully flexible join specification and reuses the capabilities of where clauses. Of course,
9-
not all capabilities are supported in databases, but you should now be able to code any type of join specification.
6+
## Kotlin Join Syntax
107

8+
The Java DSL for joins was changed to allow much more flexible joins. Of course, not all capabilities are supported in
9+
all databases, but you should now be able to code most joins specification that are supported by your database.
1110
The changes in the Java DSL are mostly internal and should not impact most users. The `equalTo` methods has been
1211
deprecated in favor of `isEqualTo`, but all other changes should be hidden.
1312

14-
V1 Join Specification Example:
15-
```java
16-
SelectStatementProvider selectStatement = select(orderMaster.orderId, orderDetail.lineNumber, orderDetail.quantity)
17-
.from(orderMaster, "om")
18-
.join(orderDetail, "od", on(orderMaster.orderId, equalTo(orderDetail.orderId)))
19-
.build()
20-
.render(RenderingStrategies.MYBATIS3);
21-
```
13+
Like the Java DSL, the V2 Kotlin DSL offers a fully flexible join specification and allows for much more flexible join
14+
specifications. The changes in the Kotlin DSL allow a more natural expressions of a join specification. The main
15+
difference is that the "on" keyword should be moved outside the join specification lambda (it is now an infix function).
16+
Inside the lambda, the conditions should be rewritten to match the syntax of a where clause.
2217

23-
V2 Join Specification Example:
24-
```java
25-
SelectStatementProvider selectStatement = select(orderMaster.orderId, orderDetail.lineNumber, orderDetail.quantity)
26-
.from(orderMaster, "om")
27-
.join(orderDetail, "od", on(orderMaster.orderId, isEqualTo(orderDetail.orderId)))
28-
.build()
29-
.render(RenderingStrategies.MYBATIS3);
30-
```
31-
32-
## Kotlin Join Syntax
33-
34-
Like the Java DSL, the V2 Kotlin DSL offers a fully flexible join specification and reuses the capabilities of where
35-
clauses. Of course, not all capabilities are supported in databases, but you should now be able to code any type of
36-
join specification.
37-
38-
The changes in the Kotlin DSL allow a more natural expressions of a join specification. The main difference is that
39-
the "on" keyword should be moved outside the join specification lambda (it is now an infix function). Inside the lambda,
40-
the conditions should be rewritten to match the syntax of a where clause.
41-
42-
V1 Join Specification Example:
18+
V1 (Deprecated) Join Specification Example:
4319
```kotlin
4420
val selectStatement = select(
4521
orderMaster.orderId, orderMaster.orderDate,
@@ -65,5 +41,9 @@ val selectStatement = select(
6541
and { orderMaster.orderId isEqualTo constant("1") }
6642
}
6743
}
68-
6944
```
45+
46+
Notice that the "on" keyword has been moved outside the lambda, and the conditions are coded with the same syntax used
47+
by WHERE, HAVING, and CASE expressions.
48+
49+
The prior syntax is deprecated and will be removed in a future release.

0 commit comments

Comments
 (0)