Skip to content

Commit

Permalink
Merge pull request #520 from jeffgbutler/master
Browse files Browse the repository at this point in the history
Documentation updates
  • Loading branch information
jeffgbutler authored Nov 24, 2019
2 parents a2004c8 + 575149a commit dd3b273
Show file tree
Hide file tree
Showing 14 changed files with 223 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ protected void addUpdateByPrimaryKeySelectiveMethod(Interface interfaze) {

generate(interfaze, generator);
}

protected void addBasicCountMethod(Interface interfaze) {
BasicCountMethodGenerator generator = new BasicCountMethodGenerator.Builder()
.withContext(context)
Expand Down
2 changes: 1 addition & 1 deletion core/mybatis-generator-core/src/site/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<item href="configreference/table.html" name="&amp;lt;table&amp;gt;" />
</item>
<item href="generatedobjects/results.html" name="Using the Generated Objects" collapse="true" >
<item href="generatedobjects/dynamicSqlV2.html" name="MyBatis Dynamic SQL Usage Notes - V2" />
<item href="generatedobjects/dynamicSqlV2.html" name="MyBatis Dynamic SQL Usage Notes" />
<item href="generatedobjects/dynamicSqlKotlin.html" name="MyBatis Dynamic SQL with Kotlin Usage Notes" />
<item href="generatedobjects/legacy.html" name="Legacy Generators">
<item href="generatedobjects/javamodel.html" name="Java Model Objects" />
Expand Down
8 changes: 3 additions & 5 deletions core/mybatis-generator-core/src/site/xhtml/afterRunning.xhtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2018 the original author or authors.
Copyright 2006-2019 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -79,10 +79,8 @@ of your project. The <code>MapperConfig.xml</code> file should have these entri
then the files can be listed in any order with repeated <code>&lt;mapper&gt;</code>
elements after the <code>&lt;mappers&gt;</code> element.</p>

<p><b>Generated MapperConfig.xml</b> You may ask
MBG to generate a skeleton Mapper Configuration file with the MapperConfigPlugin.
See the <a href="configreference/plugin.html">&lt;plugin&gt;</a>
page for more information.</p>
<p>If you use Java based configuration, or Spring, then you will need to register mappers with your configuration
in the manner applicable for your environment.</p>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ databases, or with different generation parameters, in the same run of MyBatis G
<tr>
<td valign="top">defaultModelType</td>
<td>
This property is used to set the default for generated model types.
<i>This attribute is ignored if the target runtime is "MyBatis3Simple", "MyBatis3DynamicSql",
or "MyBatis3Kotlin"</i><br/>
This attribute is used to set the default for generated model types.
The model type defines how MBG will generate domain classes. With some
model types MBG will generate a single domain class for each table,
with others MBG may generate different classes depending on the structure
Expand Down Expand Up @@ -92,12 +94,7 @@ databases, or with different generation parameters, in the same run of MyBatis G
<table>
<tr>
<th valign="top">MyBatis3DynamicSql</th>
<td><i>This is the default value</i>
<br/>Synonym for MyBatis3DynamicSqlV2</td>
</tr>
<tr>
<th valign="top">MyBatis3DynamicSqlV2</th>
<td>
<td><i>This is the default value</i><br/>
With the value, MBG will generate objects that are compatible
with MyBatis versions 3.4.2 and higher, and Java 8 and higher (e.g. the
Java model and mapper interfaces will use generic types and other Java 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2018 the original author or authors.
Copyright 2006-2019 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -86,7 +86,8 @@ specified with the <a href="property.html">&lt;property&gt;</a> child element:</
is set "true".</p>
<p>This property can be overridden by the corresponding property in a
<a href="table.html">&lt;table&gt;</a> element.</p>
<p><i>The default value is false.</i></p></td>
<p><i>The default value is false.</i></p>
<p><i>This property is ignored if the target runtime is "MyBatis3Kotlin"</i></p></td>
</tr>
<tr>
<td valign="top">enableSubPackages</td>
Expand All @@ -105,15 +106,15 @@ specified with the <a href="property.html">&lt;property&gt;</a> child element:</
<td>
This property is used to specify a different package for the generated example objects. If not specified,
the example objects will be generated in the same package as other model objects.
<p>Note: this property is ignored in the MyBatis Dynamic SQL runtime.</p>
<p>Note: this property is ignored in the MyBatis Dynamic SQL based runtimes.</p>
</td>
</tr>
<tr>
<td valign="top">exampleTargetProject</td>
<td>
This property is used to specify a different project for the generated example objects. If not specified,
the example objects will be generated in the same project as other model objects.
<p>Note: this property is ignored in the MyBatis Dynamic SQL runtime.</p>
<p>Note: this property is ignored in the MyBatis Dynamic SQL based runtimes.</p>
</td>
</tr>
<tr>
Expand All @@ -126,7 +127,8 @@ specified with the <a href="property.html">&lt;property&gt;</a> child element:</
regardless of the value of the "constructorBased" property.</p>
<p>This property can be overridden by the corresponding property in a
<a href="table.html">&lt;table&gt;</a> element.</p>
<p><i>The default value is false.</i></p></td>
<p><i>The default value is false.</i></p>
<p><i>This property is ignored if the target runtime is "MyBatis3Kotlin"</i></p></td>
</tr>
<tr>
<td valign="top">rootClass</td>
Expand All @@ -146,7 +148,8 @@ specified with the <a href="property.html">&lt;property&gt;</a> child element:</
<li>Property has a "setter" method</li>
</ul>
<p>If specified, the value of this property should be a fully qualified
class name (like com.mycompany.MyRootClass).</p></td>
class name (like com.mycompany.MyRootClass).</p>
<p><i>This property is ignored if the target runtime is "MyBatis3Kotlin"</i></p></td>
</tr>
<tr>
<td valign="top">trimStrings</td>
Expand All @@ -158,7 +161,8 @@ specified with the <a href="property.html">&lt;property&gt;</a> child element:</
Can be overridden with the <code>trimStrings</code> property in a
<a href="table.html">&lt;table&gt;</a> or
<a href="columnOverride.html">&lt;columnOverride&gt;</a> element.
<p><i>The default value is false.</i></p></td>
<p><i>The default value is false.</i></p>
<p><i>This property is ignored if the target runtime is "MyBatis3Kotlin"</i></p></td>
</tr>
</table>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2018 the original author or authors.
Copyright 2006-2019 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,6 +34,9 @@ You can also substitute your own implementation if you want different
behavior than the default. This element is an optional child element
of the <a href="context.html">&lt;context&gt;</a> element.</p>

<p>Note: if you use the MyBatis3Kotlin runtime, then the generator will automatically convert Java types to their
appropriate Kotlin equivalents when applicable.</p>

<h2>Required Attributes</h2>
<p>None</p>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2018 the original author or authors.
Copyright 2006-2019 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,8 @@ generator. The SQL Map Generator builds a MyBatis formatted SQL map XML file
for each introspected table.</p>
<p>This element is a required child element
of the <a href="context.html">&lt;context&gt;</a> element only if your chosen
javaClientGenerator requires XML.</p>
javaClientGenerator requires XML. The runtimes based on MyBatis Dynamic SQL do not generate XML and will
ignore this element if it is specified.</p>
<p>If you do not specify a javaClientGenerator, then
the following rules apply:</p>
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>MyBatis Dynamic SQL V2 Usage Notes</title>
<title>MyBatis Dynamic SQL Usage Notes</title>
<link rel="stylesheet" type="text/css" href="../mbgstyle.css" />
</head>
<body>
<h1>MyBatis Dynamic SQL V2 Usage Notes</h1>
<p>This page is a short introduction to using the classes generated for the MyBatis3DynamicSQL runtime (also available as
MyBatis3DynamicSQLV2). These classes
<h1>MyBatis Dynamic SQL Usage Notes</h1>
<p>This page is a short introduction to using the classes generated for the MyBatis3DynamicSQL runtime. These classes
are dependent on the <a href="http://www.mybatis.org/mybatis-dynamic-sql/docs/introduction.html">MyBatis Dynamic SQL</a>
library. Please refer to that site for full information
about how the library works.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
<h1>Using the Generated Objects</h1>
<p>MyBatis Generator (MBG) generates different types of objects depending on the runtime chosen (configured via the targetRuntime
attribute on a &lt;context&gt;)</p>
<table cellspacing="0">
<table border="1" cellspacing="0">
<tr>
<th>Runtime</th>
<th>Comments</th>
<th>Details</th>
</tr>
<tr>
<td>MyBatis3DynamicSql or MyBatis3DynamicSqlV2 (the default runtime)</td>
<td>MyBatis3DynamicSql</td>
<td>This is the default runtime. It is the recommended runtime for all new Java projects</td>
<td><a href="dynamicSqlV2.html">Details Page</a></td>
</tr>
Expand Down
21 changes: 14 additions & 7 deletions core/mybatis-generator-core/src/site/xhtml/index.xhtml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2006-2018 the original author or authors.
Copyright 2006-2019 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,9 +34,12 @@
percentage of database operations that are simple CRUD (Create, Retrieve, Update, Delete). You will
still need to hand code SQL and objects for join queries, or stored procedures.
</p>
<p>MyBatis Generator will generate:</p>
<p>MBG generates code in different styles, and for different languages, depending on how it is configured. For example,
MBG can generate Java or Kotlin code. And MBG can generate MyBatis3 compatible XML - althought that is now considered
a legacy use of MBG. The newer styles of generated code do not require XML.</p>
<p>Depending on how it is configured, MyBatis Generator may generate:</p>
<ul>
<li>Java POJOs that match the table structure. This may include:
<li>Java or Kotlin classes that match the table structure. This may include:
<ul>
<li>a class to match the primary key of the table (if there is a primary key)</li>
<li>a class to match the non-primary key fields of the table (except BLOB fields)</li>
Expand All @@ -48,7 +51,7 @@
for example, you may choose to generate a single domain object for each table if you so
desire.</p>
</li>
<li>MyBatis Compatible SQL Map XML Files. MBG generates SQL for simple
<li>In some cases, MBG will generate MyBatis3 Compatible SQL Map XML Files. MBG generates SQL for simple
CRUD functions on each table in a configuration. The generated SQL
statements include:
<ul>
Expand All @@ -65,8 +68,8 @@
structure of the table (for example, if the table doesn't have a primary key,
then MBG will not generate an update by primary key function).</p>
</li>
<li>Java client classes that make appropriate use of the
above objects. The generation of Java client classes is optional.
<li>Java or Kotlin client classes, interfaces, and Kotlin extension methods that make appropriate use of the
above objects. The generation of client classes is optional.
MBG will generate a mapper interface that works with the MyBatis 3.x mapper infrastructure</li>
</ul>

Expand All @@ -88,6 +91,10 @@
merge the changes by hand. When run as an
<a target="_blank" href="http://www.eclipse.org">Eclipse</a>
plugin, then MBG can automatically merge Java files.</li>
<li>MBG will <b>not</b> merge Kotlin files, it can either overwrite existing files
or save newly generated files with a different unique name. If you make changes
to the generated Kotlin files and run MBG iteratively you will have to
merge the changes by hand.</li>
</ol>

<h2>Running with Eclipse</h2>
Expand Down Expand Up @@ -128,4 +135,4 @@ you may open a new issue at GitHub here:</p>
</blockquote>

</body>
</html>
</html>
Loading

0 comments on commit dd3b273

Please sign in to comment.