Skip to content

Commit d15936e

Browse files
committed
Update upstream docs
1 parent e3b467f commit d15936e

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

src/site/zh/xdoc/configuration.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
321321
defaultResultSetType
322322
</td>
323323
<td>
324-
Specifies a scroll strategy when omit it per statement settings. (Since: 3.5.2)
324+
指定语句默认的滚动策略。(新增于 3.5.2
325325
</td>
326326
<td>
327-
FORWARD_ONLY | SCROLL_SENSITIVE | SCROLL_INSENSITIVE | DEFAULT(same behavior with 'Not Set')
327+
FORWARD_ONLY | SCROLL_SENSITIVE | SCROLL_INSENSITIVE | DEFAULT(等同于未设置)
328328
</td>
329329
<td>
330-
Not Set (null)
330+
未设置 (null)
331331
</td>
332332
</tr>
333333
<tr>
@@ -1648,8 +1648,8 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, propert
16481648
TransactionFactory 接口实现类的全限定名或类型别名代替它们。
16491649
</p>
16501650
<source><![CDATA[public interface TransactionFactory {
1651-
default void setProperties(Properties props) { // Since 3.5.2, change to default method
1652-
// NOP
1651+
default void setProperties(Properties props) { // 3.5.2 开始,该方法为默认方法
1652+
// 空实现
16531653
}
16541654
Transaction newTransaction(Connection conn);
16551655
Transaction newTransaction(DataSource dataSource, TransactionIsolationLevel level, boolean autoCommit);
@@ -1688,7 +1688,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, propert
16881688
</li>
16891689
<li><code>defaultTransactionIsolationLevel</code> – 默认的连接事务隔离级别。
16901690
</li>
1691-
<li><code>defaultNetworkTimeout</code> – The default network timeout value in milliseconds to wait for the database operation to complete. See the API documentation of <code>java.sql.Connection#setNetworkTimeout()</code> for details.
1691+
<li><code>defaultNetworkTimeout</code> – 等待数据库操作完成的默认网络超时时间(单位:毫秒)。查看 <code>java.sql.Connection#setNetworkTimeout()</code> 的 API 文档以获取更多信息。
16921692
</li>
16931693
</ul>
16941694
<p>作为可选项,你也可以传递属性给数据库驱动。只需在属性名加上“driver.”前缀即可,例如:

src/site/zh/xdoc/java-api.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<p>
7272
<span class="label important">提示</span> 当 Mybatis 与一些依赖注入框架(如 Spring 或者 Guice)搭配使用时,SqlSession 将被依赖注入框架创建并注入,所以你不需要使用 SqlSessionFactoryBuilder 或者 SqlSessionFactory,可以直接阅读 SqlSession 这一节。请参考 Mybatis-Spring 或者 Mybatis-Guice 手册以了解更多信息。</p>
7373
<h4>SqlSessionFactoryBuilder</h4>
74-
<p>SqlSessionFactoryBuilder 有五个 build() 方法,每一种都允许你从不同的资源中创建一个 SqlSession 实例。</p>
74+
<p>SqlSessionFactoryBuilder 有五个 build() 方法,每一种都允许你从不同的资源中创建一个 SqlSessionFactory 实例。</p>
7575
<source>SqlSessionFactory build(InputStream inputStream)
7676
SqlSessionFactory build(InputStream inputStream, String environment)
7777
SqlSessionFactory build(InputStream inputStream, Properties properties)
@@ -350,7 +350,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
350350
<li><code>&lt;idArg&gt;</code></li>
351351
</ul>
352352
</td>
353-
       <td>ConstructorArgs 集合的一部分,代表一个构造方法参数。属性:<code>id</code>、<code>column</code>、<code>javaType</code>、<code>jdbcType</code>、<code>typeHandler</code>、<code>select</code>、<code>resultMap</code>。id 属性和 XML 元素 <code>&lt;idArg&gt;</code> 相似,它是一个布尔值,表示该属性是否用于唯一标识和比较对象。</td>
353+
       <td>ConstructorArgs 集合的一部分,代表一个构造方法参数。属性:<code>id</code>、<code>column</code>、<code>javaType</code>、<code>jdbcType</code>、<code>typeHandler</code>、<code>select</code>、<code>resultMap</code>。id 属性和 XML 元素 <code>&lt;idArg&gt;</code> 相似,它是一个布尔值,表示该属性是否用于唯一标识和比较对象。从版本 3.5.4 开始,该注解变为可重复注解。</td>
354354
</tr>
355355
<tr>
356356
<td><code>@TypeDiscriminator</code></td>
@@ -368,7 +368,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
368368
<td><code>@Results</code></td>
369369
<td><code>方法</code></td>
370370
<td><code>&lt;resultMap&gt;</code></td>
371-
<td>一组结果映射,指定了对某个特定结果列,映射到某个属性或字段的方式。属性:<code>value</code>、<code>id</code>。value 属性是一个 <code>Result</code> 注解的数组。而 id 属性则是结果映射的名称。</td>
371+
<td>一组结果映射,指定了对某个特定结果列,映射到某个属性或字段的方式。属性:<code>value</code>、<code>id</code>。value 属性是一个 <code>Result</code> 注解的数组。而 id 属性则是结果映射的名称。从版本 3.5.4 开始,该注解变为可重复注解。</td>
372372
</tr>
373373
<tr>
374374
<td><code>@Result</code></td>
@@ -444,7 +444,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
444444
<li><code>&lt;select&gt;</code></li>
445445
</ul>
446446
</td>
447-
       <td>允许构建动态 SQL。这些备选的 SQL 注解允许你指定返回 SQL 语句的类和方法,以供运行时执行。(从 MyBatis 3.4.6 开始,可以使用 <code>CharSequence</code> 代替 <code>String</code> 来作为返回类型)。当执行映射语句时,MyBatis 会实例化注解指定的类,并调用注解指定的方法。你可以通过 <code>ProviderContext</code> 传递映射方法接收到的参数、"Mapper interface type" 和 "Mapper method"(仅在 MyBatis 3.4.5 以上支持)作为参数。(MyBatis 3.4 以上支持传入多个参数)属性:<code>type</code>、<code>method</code>。<code>type</code> 属性用于指定类名。<code>method</code> 用于指定该类的方法名。<span class="label important">提示</span> 接下来的“SQL 语句构建器”一章将会讨论该话题,以帮助你以更清晰、更便于阅读的方式构建动态 SQL。</td>
447+
       <td>允许构建动态 SQL。这些备选的 SQL 注解允许你指定返回 SQL 语句的类和方法,以供运行时执行。(从 MyBatis 3.4.6 开始,可以使用 <code>CharSequence</code> 代替 <code>String</code> 来作为返回类型)。当执行映射语句时,MyBatis 会实例化注解指定的类,并调用注解指定的方法。你可以通过 <code>ProviderContext</code> 传递映射方法接收到的参数、"Mapper interface type" 和 "Mapper method"(仅在 MyBatis 3.4.5 以上支持)作为参数。(MyBatis 3.4 以上支持传入多个参数)属性:<code>type</code>、<code>method</code>。<code>type</code> 属性用于指定类名。<code>method</code> 用于指定该类的方法名(从版本 3.5.1 开始,可以忽略 <code>method</code> 属性,MyBatis 将会使用 <code>ProviderMethodResolver</code> 接口解析方法的具体实现。如果解析失败,MyBatis 将会使用名为 <code>provideSql</code> 的降级实现)。<span class="label important">提示</span> 接下来的“SQL 语句构建器”一章将会讨论该话题,以帮助你以更清晰、更便于阅读的方式构建动态 SQL。</td>
448448
</tr>
449449
<tr>
450450
<td><code>@Param</code></td>
@@ -552,13 +552,14 @@ class UserSqlBuilder {
552552
}
553553
}]]></source>
554554

555-
<p>This example shows usage the default implementation of <code>ProviderMethodResolver</code>(available since MyBatis 3.5.1 or later):</p>
555+
<p>以下例子展示了 <code>ProviderMethodResolver</code>(3.5.1 后可用)的默认实现使用方法:
556+
</p>
556557
<source><![CDATA[@SelectProvider(UserSqlProvider.class)
557558
List<User> getUsersByName(String name);
558559
559-
// Implements the ProviderMethodResolver on your provider class
560+
// 在你的 provider 类中实现 ProviderMethodResolver 接口
560561
class UserSqlProvider implements ProviderMethodResolver {
561-
// In default implementation, it will resolve a method that method name is matched with mapper method
562+
// 默认实现中,会将映射器方法的调用解析到实现的同名方法上
562563
public static String getUsersByName(final String name) {
563564
return new SQL(){{
564565
SELECT("*");

src/site/zh/xdoc/statement-builders.xml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ public String updatePersonSql() {
313313
</ul>
314314
</td>
315315
<td>
316-
Appends a <code>LIMIT</code> clause.
317-
This method valid when use together with SELECT(), UPDATE() and DELETE().
318-
And this method is designed to use together with OFFSET() when use SELECT(). (Available since 3.5.2)
316+
追加新的 <code>LIMIT</code> 子句。
317+
仅在 SELECT()UPDATE()DELETE() 时有效。
318+
当在 SELECT() 中使用时,应该配合 OFFSET() 使用。(于 3.5.2 引入)
319319
</td>
320320
</tr>
321321
<tr>
@@ -330,9 +330,9 @@ public String updatePersonSql() {
330330
</ul>
331331
</td>
332332
<td>
333-
Appends a <code>OFFSET</code> clause.
334-
This method valid when use together with SELECT().
335-
And this method is designed to use together with LIMIT(). (Available since 3.5.2)
333+
追加新的 <code>OFFSET</code> 子句。
334+
仅在 SELECT() 时有效。
335+
当在 SELECT() 时使用时,应该配合 LIMIT() 使用。(于 3.5.2 引入)
336336
</td>
337337
</tr>
338338
<tr>
@@ -347,9 +347,9 @@ public String updatePersonSql() {
347347
</ul>
348348
</td>
349349
<td>
350-
Appends a <code>OFFSET n ROWS</code> clause.
351-
This method valid when use together with SELECT().
352-
And this method is designed to use together with FETCH_FIRST_ROWS_ONLY(). (Available since 3.5.2)
350+
追加新的 <code>OFFSET n ROWS</code> 子句。
351+
仅在 SELECT() 时有效。
352+
该方法应该配合 FETCH_FIRST_ROWS_ONLY() 使用。(于 3.5.2 加入)
353353
</td>
354354
</tr>
355355
<tr>
@@ -364,9 +364,9 @@ public String updatePersonSql() {
364364
</ul>
365365
</td>
366366
<td>
367-
Appends a <code>FETCH FIRST n ROWS ONLY</code> clause.
368-
This method valid when use together with SELECT().
369-
And this method is designed to use together with OFFSET_ROWS(). (Available since 3.5.2)
367+
追加新的 <code>FETCH FIRST n ROWS ONLY</code> 子句。
368+
仅在 SELECT() 时有效。
369+
该方法应该配合 OFFSET_ROWS() 使用。(于 3.5.2 加入)
370370
</td>
371371
</tr>
372372
<tr>
@@ -431,18 +431,16 @@ public String updatePersonSql() {
431431
<code>ADD_ROW()</code>
432432
</td>
433433
<td>
434-
Add new row for bulk insert. (Available since 3.5.2)
434+
添加新的一行数据,以便执行批量插入。(于 3.5.2 引入)
435435
</td>
436436
</tr>
437437
</tbody>
438438
</table>
439439

440440
<p>
441-
<span class="label important">NOTE</span>
442-
It is important to note that SQL class writes <code>LIMIT</code>, <code>OFFSET</code>, <code>OFFSET n ROWS</code> and <code>FETCH FIRST n ROWS ONLY</code> clauses into the generated statement as is.
443-
In other words, the library does not attempt to normalize those values for databases that don’t support these clauses directly.
444-
Therefore, it is very important for users to understand whether or not the target database supports these clauses.
445-
If the target database does not support these clauses, then it is likely that using this support will create SQL that has runtime errors.
441+
<span class="label important">提示</span>
442+
注意,SQL 类将原样插入 <code>LIMIT</code>、<code>OFFSET</code>、<code>OFFSET n ROWS</code> 以及 <code>FETCH FIRST n ROWS ONLY</code> 子句。换句话说,类库不会为不支持这些子句的数据库执行任何转换。
443+
因此,用户应该要了解目标数据库是否支持这些子句。如果目标数据库不支持这些子句,产生的 SQL 可能会引起运行错误。
446444
</p>
447445

448446
<p>从版本 3.4.2 开始,你可以像下面这样使用可变长度参数:</p>
@@ -474,7 +472,7 @@ public String updatePersonSql() {
474472
}
475473
]]></source>
476474

477-
<p>Since version 3.5.2, you can create insert statement for bulk insert as follow:</p>
475+
<p>从版本 3.5.2 开始,你可以像下面这样构建批量插入语句:</p>
478476

479477
<source><![CDATA[
480478
public String insertPersonsSql() {

0 commit comments

Comments
 (0)