You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/site/markdown/docs/functions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Database Functions
2
2
3
-
The library supplies implementations for several common database functions. We do not try to implement a large set of functions. Rather we supply some common functions as examples and make it relatively easy to write your own implementations of functions you might want to use that are not supplied by the library. See the page "Extending the Library" for informtion about how to write your own functions.
3
+
The library supplies implementations for several common database functions. We do not try to implement a large set of functions. Rather we supply some common functions as examples and make it relatively easy to write your own implementations of functions you might want to use that are not supplied by the library. See the page "Extending the Library" for information about how to write your own functions.
4
4
5
5
The supplied functions are all in the `org.mybatis.dynamic.sql.select.function` package. In addition, there are static methods in the `SqlBuilder` to access all functions.
Copy file name to clipboardExpand all lines: src/site/markdown/docs/insert.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -215,7 +215,7 @@ It is important to open a MyBatis session by setting the executor type to BATCH.
215
215
Notice that the same mapper method that is used to insert a single record is now executed multiple times. The `map` methods are the same with the exception that the `toPropertyWhenPresent` mapping is not supported for batch inserts.
216
216
217
217
## General Insert Statement
218
-
A general insert is used to build arbitrary insert statements. The general insert does not require a separate record object o hold values for the statement - any value can be passed into the statement. This version of the insert is not convienient for retriving generated keys with MyBatis - for that use case we recommend the "single record insert". However the general insert is perfectly acceptible for Spring JDBC template or MyBatis inserts that do not return generated keys. For example
218
+
A general insert is used to build arbitrary insert statements. The general insert does not require a separate record object to hold values for the statement - any value can be passed into the statement. This version of the insert is not convenient for retrieving generated keys with MyBatis - for that use case we recommend the "single record insert". However the general insert is perfectly acceptable for Spring JDBC template or MyBatis inserts that do not return generated keys. For example
Copy file name to clipboardExpand all lines: src/site/markdown/docs/kotlinSpring.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This page will show our recommended pattern for using the MyBatis Dynamic SQL wi
6
6
All Kotlin support for Spring is available in two packages:
7
7
8
8
*`org.mybatis.dynamic.sql.util.kotlin` - contains extension methods and utilities to enable an idiomatic Kotlin DSL for MyBatis Dynamic SQL. These objects can be used for clients using any execution target (i.e. MyBatis3 or Spring JDBC Templates)
9
-
*`org.mybatis.dynamic.sql.util.kotlin.spring` - contains utlities specifically to simplify integration with Spring JDBC Template
9
+
*`org.mybatis.dynamic.sql.util.kotlin.spring` - contains utilities specifically to simplify integration with Spring JDBC Template
10
10
11
11
The Kotlin support for Spring is implemented as extension methods to `NamedParameterJdbcTemplate`. There are extension methods to support count, delete, insert, select, and update operations based on SQL generated by this library. For each operation, there are two different methods of executing SQL. With the first method you build the appropriate SQL provider object as a separate step before executing the SQL. The second method combines these two operations into a single step. We will illustrate both approaches below.
12
12
@@ -85,7 +85,7 @@ This is the two step execution process. This can be combined into a single step
85
85
}
86
86
```
87
87
88
-
There is also an extention method that can be used to count all rows in a table:
88
+
There is also an extension method that can be used to count all rows in a table:
89
89
90
90
```kotlin
91
91
val rows = template.countFrom(Person) {
@@ -120,7 +120,7 @@ This is the two step execution process. This can be combined into a single step
120
120
}
121
121
```
122
122
123
-
There is also an extention method that can be used to count all rows in a table:
123
+
There is also an extension method that can be used to count all rows in a table:
124
124
125
125
```kotlin
126
126
val rows = template.deleteFrom(Person) {
@@ -278,7 +278,7 @@ This is the two step execution process. This can be combined into a single step
278
278
}
279
279
```
280
280
281
-
There are similar methods for selecing a single row, or executing a select distinct query. For example, you could implement a "select by primary key" method using code like this:
281
+
There are similar methods for selecting a single row, or executing a select distinct query. For example, you could implement a "select by primary key" method using code like this:
282
282
283
283
```kotlin
284
284
val record = template.selectOne(id, firstName, lastName, birthDate, employed, occupation, addressId)
@@ -299,7 +299,7 @@ There are similar methods for selecing a single row, or executing a select disti
299
299
300
300
In this case, the data type for `record` would be `PersonRecord?` - a nullable value.
301
301
302
-
There is also an extention method that can be used to select all rows in a table:
302
+
There is also an extension method that can be used to select all rows in a table:
303
303
304
304
```kotlin
305
305
val rows = template.select(id, firstName, lastName, birthDate, employed, occupation, addressId)
Copy file name to clipboardExpand all lines: src/site/markdown/docs/mybatis3.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ To use this support, we envision creating several methods on a MyBatis mapper in
16
16
long count(SelectStatementProvider selectStatement);
17
17
```
18
18
19
-
This is a standard method for MyBatis Dynamic SQL that executes a query and returns a `long`. The other methods will reuse this method and supply everything needed to build the select statement except the where clause. There are several varients of count queries that may be useful:
19
+
This is a standard method for MyBatis Dynamic SQL that executes a query and returns a `long`. The other methods will reuse this method and supply everything needed to build the select statement except the where clause. There are several variants of count queries that may be useful:
20
20
21
21
1.`count(*)` - counts the number of rows that match a where clause
22
22
1.`count(column)` - counts the number of non-null column values that match a where clause
Copy file name to clipboardExpand all lines: src/site/markdown/docs/spring.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,6 @@ The SQL statement objects are created in exactly the same way as for MyBatis - o
17
17
MyBatis3 is a higher level abstraction over JDBC than Spring JDBC templates. While most functions in the library will work with Spring, there are some functions that do not work:
18
18
19
19
1. Spring JDBC templates do not have anything equivalent to a type handler in MyBatis3. Therefore it is best to use data types that can be automatically understood by Spring
20
-
1. The multiple row insert statement *will not* render properly for Spring. However, batch inserts *will* render properly for Spring
21
20
22
21
## Executing Select Statements
23
22
The Spring Named Parameter JDBC template expects an SQL statement with parameter markers in the Spring format, and a set of matched parameters. MyBatis Dynamic SQL will generate both. The parameters returned from the generated SQL statement can be wrapped in a Spring `MapSqlParameterSource`. Spring also expects you to provide a row mapper for creating the returned objects. The following code shows a complete example:
0 commit comments