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: README.md
+9-247Lines changed: 9 additions & 247 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,256 +18,18 @@ templates.
18
18
The library works by implementing an SQL-like DSL that creates an object containing a full SQL statement and any
19
19
parameters required for that statement. The SQL statement object can be used directly by MyBatis as a parameter to a mapper method.
20
20
21
-
The library will generate these types of SQL statements:
21
+
The library also contains extensions for Kotlin that enable an idiomatic Kotlin DSL.
22
22
23
-
- DELETE statements with flexible WHERE clauses
24
-
- INSERT statements of several types:
25
-
- A statement that inserts a single record and will insert null values into columns (a "full" insert)
26
-
- A statement that inserts a single record that will ignore null input values and their associated columns (a "selective" insert)
27
-
- A statement that inserts into a table using the results of a SELECT statement
28
-
- A parameter object is designed for inserting multiple objects with a JDBC batch
29
-
- SELECT statements with a flexible column list, a flexible WHERE clause, and support for distinct, "group by", joins, unions, "order by", etc.
30
-
- UPDATE statements with a flexible WHERE clause. Like the INSERT statement, there are two varieties of UPDATE statements:
31
-
- A "full" update that will set null values
32
-
- A "selective" update that will ignore null input values
23
+
See the following pages for further information:
33
24
34
-
The primary goals of the library are:
35
-
36
-
1. Typesafe - to the extent possible, the library will ensure that parameter types match
37
-
the database column types
38
-
2. Expressive - statements are built in a way that clearly communicates their meaning
39
-
(thanks to Hamcrest for some inspiration)
40
-
3. Flexible - where clauses can be built using any combination of and, or, and nested conditions
41
-
4. Extensible - the library will render statements for MyBatis3, Spring JDBC templates or plain JDBC.
42
-
It can be extended to generate clauses for other frameworks as well. Custom where conditions can
43
-
be added easily if none of the built in conditions are sufficient for your needs.
44
-
5. Small - the library is a small dependency to add. It has no transitive dependencies.
45
-
46
-
This library grew out of a desire to create a utility that could be used to improve the code
47
-
generated by MyBatis Generator, but the library can be used on it's own with very little setup required.
25
+
| Page | Comments|
26
+
|------|---------|
27
+
|[Quick Start](src/site/markdown/docs/quickStart.md)| Shows a complete example of building code for this library |
28
+
|[MyBatis3 Support](src/site/markdown/docs/mybatis3.md)| Information about specialized support for [MyBatis3](https://github.com/mybatis/mybatis-3). The examples on this page are similar to the code generated by [MyBatis Generator](https://github.com/mybatis/generator)|
29
+
|[Spring Support](src/site/markdown/docs/spring.md)| Information about specialized support for Spring JDBC Templates |
30
+
|[Spring Batch Support](src/site/markdown/docs/springBatch.md)| Information about specialized support for Spring Batch using the [MyBatis Spring Integration](https://github.com/mybatis/spring)|
31
+
|[Kotlin Support](src/site/markdown/docs/kotlin.md)| Information about the Kotlin extensions and Kotlin DSL |
48
32
49
33
## Requirements
50
34
51
35
The library has no dependencies. Java 8 or higher is required.
52
-
53
-
## Show Me an Example
54
-
One capability is that very expressive dynamic queries can be generated. Here's an example of what's possible:
### Second - Write MyBatis mappers that will use the generated statement
149
-
The library will create classes that will be used as input to a MyBatis mapper. These classes include the generated SQL, as well as a parameter set that will match the generated SQL. Both are required by MyBatis. It is intended that these objects be the one and only parameter to a MyBatis mapper method.
150
-
151
-
The library can be used with both XML and annotated mappers, but we recommend using MyBatis' annotated mapper support in all cases. The only case where XML is required is when you code a JOIN statement - in that case you will need to define your result map in XML due to limitations of the MyBatis annotations in supporting joins.
0 commit comments