Skip to content

Commit c204857

Browse files
committed
Fix explanation for the default value of keyProperty mybatis#1198
1 parent cbdc960 commit c204857

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2017 the original author or authors.
4+
Copyright 2009-2018 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -413,7 +413,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
413413
<td><code>@Options</code></td>
414414
<td><code>Method</code></td>
415415
<td>Attributes of mapped statements.</td>
416-
<td>Esta anotación proporciona acceso a un gran conjunto de opciones de configuración que normalmente aparecen como atributos en los mapped statements. En lugar de complicar cada anotación existente la anotación Options proporciona una forma sencilla y concisa de acceder a estas opciones. Atributos: useCache=true, flushCache=FlushCachePolicy.DEFAULT, resultSetType=FORWARD_ONLY, statementType=PREPARED, fetchSize=-1, timeout=-1, useGeneratedKeys=false, keyProperty=“id”, keyColumn=“”, resultSets=“”. Es importante comprender que las anotaciones en Java no permiten indicar un valor nulo. Por lo tanto, cuando usas la anotación Options el statement usará todos los valores por defecto. Presta atención a estos valores pro defecto para evitar comportamientos inesperados. La keyColumn solo se requiere para algunas bases de datos (como PostgreSQL) cuando la columna no es la primera columna de la tabla.</td>
416+
<td>Esta anotación proporciona acceso a un gran conjunto de opciones de configuración que normalmente aparecen como atributos en los mapped statements. En lugar de complicar cada anotación existente la anotación Options proporciona una forma sencilla y concisa de acceder a estas opciones. Atributos: useCache=true, flushCache=FlushCachePolicy.DEFAULT, resultSetType=FORWARD_ONLY, statementType=PREPARED, fetchSize=-1, timeout=-1, useGeneratedKeys=false, keyProperty=“”, keyColumn=“”, resultSets=“”. Es importante comprender que las anotaciones en Java no permiten indicar un valor nulo. Por lo tanto, cuando usas la anotación Options el statement usará todos los valores por defecto. Presta atención a estos valores pro defecto para evitar comportamientos inesperados. La keyColumn solo se requiere para algunas bases de datos (como PostgreSQL) cuando la columna no es la primera columna de la tabla.</td>
417417
</tr>
418418
<tr>
419419
<td>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2017 the original author or authors.
4+
Copyright 2009-2018 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -422,7 +422,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
422422
<td>このアノテーションを使うと、通常マップドステートメントの属性として指定される多様なスイッチや設定オプションにアクセスすることができます。<code>Options</code> アノテーションによって、各ステートメントのアノテーションを複雑化することなく、一貫したクリーンな方法で設定にアクセスできるよう工夫されています。キー: Attributes:
423423
<code>useCache=true</code>, <code>flushCache=FlushCachePolicy.DEFAULT</code>, <code>resultSetType=FORWARD_ONLY</code>,
424424
<code>statementType=PREPARED</code>, <code>fetchSize=-1</code>, <code>timeout=-1</code>,
425-
<code>useGeneratedKeys=false</code>, <code>keyProperty="id"</code>, <code>keyColumn=""</code>, <code>resultSets=""</code>.
425+
<code>useGeneratedKeys=false</code>, <code>keyProperty=""</code>, <code>keyColumn=""</code>, <code>resultSets=""</code>.
426426
Java アノテーションを使う場合、値として <code>null</code> を指定することはできないという制限があります。これはどういうことかというと、<code>Options</code> アノテーションを付加したステートメントにはデフォルトのオプションが適用されるということです。予期しない動作を防ぐため、各オプションのデフォルト値を把握しておくようにしてください。<br/><br/>
427427
<code>keyColumn</code> は特定のデータベース(Oracle や PostgreSQL など)でのみ必須となります。
428428
<code>keyColumn</code> と <code>keyProperty</code> に対して指定可能な値については、上で出てきた insert ステートメントについての説明を参照してください。</td>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2017 the original author or authors.
4+
Copyright 2009-2018 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -536,7 +536,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
536536
fetchSize=-1,
537537
timeout=-1,
538538
useGeneratedKeys=false,
539-
keyProperty=“id”,
539+
keyProperty=“”,
540540
keyColumn=“”,
541541
resultSets=“”.
542542
자바 애노테이션을 이해하는 것이 중요하다.

src/site/xdoc/java-api.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2017 the original author or authors.
4+
Copyright 2009-2018 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -447,7 +447,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
447447
<code>Options</code> annotation provides a consistent and clear way to access these. Attributes:
448448
<code>useCache=true</code>, <code>flushCache=FlushCachePolicy.DEFAULT</code>, <code>resultSetType=FORWARD_ONLY</code>,
449449
<code>statementType=PREPARED</code>, <code>fetchSize=-1</code>, <code>timeout=-1</code>,
450-
<code>useGeneratedKeys=false</code>, <code>keyProperty="id"</code>, <code>keyColumn=""</code>, <code>resultSets=""</code>.
450+
<code>useGeneratedKeys=false</code>, <code>keyProperty=""</code>, <code>keyColumn=""</code>, <code>resultSets=""</code>.
451451
It's important to understand that with Java Annotations, there is no way to specify <code>null</code> as a value.
452452
Therefore, once you engage the <code>Options</code> annotation, your statement is subject to all of the default
453453
values. Pay attention to what the default values are to avoid unexpected behavior.<br/><br/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ try (SqlSession session = sqlSessionFactory.openSession()) {
414414
<td><code>@Options</code></td>
415415
<td><code>方法</code></td>
416416
<td>映射语句的属性</td>
417-
       <td>这个注解提供访问大范围的交换和配置选项的入口,它们通常在映射语句上作为属性出现。<code>Options</code> 注解提供了通俗易懂的方式来访问它们,而不是让每条语句注解变复杂。属性有:<code>useCache=true</code>, <code>flushCache=FlushCachePolicy.DEFAULT</code>, <code>resultSetType=FORWARD_ONLY</code>, <code>statementType=PREPARED</code>, <code>fetchSize=-1</code>, <code>timeout=-1</code>, <code>useGeneratedKeys=false</code>, <code>keyProperty="id"</code>, <code>keyColumn=""</code>, <code>resultSets=""</code>。值得一提的是, Java 注解无法指定 <code>null</code> 值。因此,一旦你使用了 <code>Options</code> 注解,你的语句就会被上述属性的默认值所影响。要注意避免默认值带来的预期以外的行为。<br/><br/>
417+
       <td>这个注解提供访问大范围的交换和配置选项的入口,它们通常在映射语句上作为属性出现。<code>Options</code> 注解提供了通俗易懂的方式来访问它们,而不是让每条语句注解变复杂。属性有:<code>useCache=true</code>, <code>flushCache=FlushCachePolicy.DEFAULT</code>, <code>resultSetType=FORWARD_ONLY</code>, <code>statementType=PREPARED</code>, <code>fetchSize=-1</code>, <code>timeout=-1</code>, <code>useGeneratedKeys=false</code>, <code>keyProperty=""</code>, <code>keyColumn=""</code>, <code>resultSets=""</code>。值得一提的是, Java 注解无法指定 <code>null</code> 值。因此,一旦你使用了 <code>Options</code> 注解,你的语句就会被上述属性的默认值所影响。要注意避免默认值带来的预期以外的行为。<br/><br/>
418418
       注意: <code>keyColumn</code> 属性只在某些数据库中有效(如 Oracle、PostgreSQL等)。请在插入语句一节查看更多关于 <code>keyColumn</code> 和 <code>keyProperty</code> 两者的有效值详情。</td>
419419
</tr>
420420
<tr>

0 commit comments

Comments
 (0)