11==================
2- バッチ挿入
2+ Batch insert
33==================
44
5- .. contents :: 目次
5+ .. contents ::
66 :depth: 3
77
8- バッチ挿入を行うには、 ``@BatchInsert `` をDaoのメソッドに注釈します。
8+ Annotate with ``@BatchInsert `` to Dao method for execute batch insert.
99
1010.. code-block :: java
1111
1818 BatchResult<ImmutableEmployee > insert (List<ImmutableEmployee > employees );
1919 }
2020
21- デフォルトでは、INSERT文が自動生成されます。
22- `` @BatchInsert `` の ``sqlFile `` に `` true `` を設定することで、任意のSQLファイルにマッピングできます。
21+ By default INSERT statement is auto generated.
22+ You can mapping arbitrary SQL file by specifying `` true `` to ``sqlFile `` property within the `` @BatchInsert `` annotation.
2323
24- パラメータの要素のに :doc: `../entity ` が指定されている場合、
25- 挿入の実行前にエンティティリスナーの ``preInsert `` メソッドをエンティティごとに呼び出します。
26- また、挿入の実行後にエンティティリスナーの ``postInsert `` メソッドをエンティティごとに呼び出します。
24+ The ``preInsert `` method of entity listener is called each entity when before executing insert if the entity listener is specified at :doc: `../entity ` parameter.
25+ Also the ``postInsert `` method of entity listener method is called each entity when after executing insert.
2726
28- 戻り値
29- ======
27+ Return value
28+ =============
3029
31- パラメータ ``Iterable `` のサブタイプの要素がイミュータブルなエンティティクラスの場合、
32- 戻り値はそのエンティティクラスを要素とする ``org.seasar.doma.BatchResult ``
33- でなければいけません。
30+ Return value must be ``org.seasar.doma.jdbc.BatchResult `` that has entity class as an element if parameter ``Iterable `` subtype element is immutable entity class.
3431
35- 上記の条件を満たさないない場合、戻り値は各更新処理の更新件数を表す ``int[] `` でなければいけません。
32+ Return value must be ``int[] `` that is represented each inserting process's updated count if the above conditions are not satisfied.
3633
37- SQLの自動生成によるバッチ挿入
38- =============================
34+ Batch insert by auto generated SQL
35+ =====================================
3936
40- パラメータの型は :doc: ` ../entity ` 要素とする ``java.lang.Iterable `` のサブタイプでなければいけません。
41- 指定できるパラメータの数は1つです。
42- 引数は ``null `` であってはいけません。
43- 戻り値の配列の要素の数はパラメータの ``Iterable `` の要素の数と等しくなります。
44- 配列のそれぞれの要素が更新された件数を返します。
37+ Parameter type must be ``java.lang.Iterable `` subtype that has :doc: ` ../entity ` as an element.
38+ Specifiable parameter is only one.
39+ Parameter must not be ``null ``.
40+ Return value array element count become equal ``Iterable `` element count.
41+ Insert count is returned to array each element.
4542
46- 識別子
47- ------
43+ Identifier
44+ -----------
4845
49- :doc: `../entity ` の識別子に、 ``@GeneratedValue `` が注釈されている場合、
50- 識別子が自動的に生成され設定されます。
46+ If annotated with ``@GeneratedValue `` at :doc: `../entity ` identifier, the identifier is auto generated and set.
5147
52- 注意点については :ref: `identity-auto-generation ` を参照ください。
48+ You reference :ref: `identity-auto-generation ` about cautionary point.
5349
54- バージョン番号
55- --------------
50+ Version number
51+ ----------------
5652
57- :doc: `../entity ` に ``@Version `` が注釈されたプロパティがある場合、
58- そのプロパティに明示的に ``0 `` 以上の値が設定されていればその値を使用します。
59- もし設定されていないか、 ``0 `` 未満の値が設定されていれば ``1 `` を自動で設定します。
53+ If value that explicitly set is over ``0 `` then use the value if :doc: `../entity ` has property that is annotated with ``@Version ``.
54+ If the value is not set or is less than ``0 `` the value is set ``1 `` automatically.
6055
61- 挿入対象プロパティ
62- ------------------
56+ Insert target property
57+ -----------------------
6358
6459insertable
6560~~~~~~~~~~
6661
67- :doc: `../entity ` に ``@Column `` が注釈されたプロパティがある場合、
68- ``@BatchInsert `` の ``insertable `` 要素が ``false `` のものは挿入対象外です。
62+ The ``insertable `` property within ``@Column `` annotation that is specified ``false `` is excluded from insert target if :doc: `../entity ` has property that is annotated with ``@Column ``.
6963
7064exclude
7165~~~~~~~
7266
73- `` @BatchInsert `` の `` exclude `` 要素に指定されたプロパティを挿入対象外とします。
74- プロパティがこの要素に指定されていれば、 `` @Column `` の `` insertable `` 要素が ``true `` であっても挿入対象外です。
67+ Property that is specified with `` exclude `` property within the `` @BatchInsert `` annotation is excluded from inserting target.
68+ Even if `` insertable `` property within `` @Column `` annotation is specified ``true `` the property is excluded from inserting target if the property is specified by this element.
7569
7670.. code-block :: java
7771
@@ -81,21 +75,20 @@ exclude
8175 include
8276~~~~~~~
8377
84- ``@BatchInsert `` の ``include `` 要素に指定されたプロパティのみを挿入対象とします。
85- ``@BatchInsert `` の ``include `` 要素と ``exclude `` 要素の両方に同じプロパティが指定された場合、
86- そのプロパティは挿入対象外になります。
87- プロパティがこの要素に指定されていても、 ``@Column `` の ``insertable `` 要素が ``false `` であれば挿入対象外です。
78+ Only property that is specified with ``include `` property within ``@BatchInsert `` annotation is included to inserting target.
79+ If same property are specified with both of ``include `` property and ``exclude `` property within ``@BatchInsert `` the property is excluded from updating target.
80+ Even if property is specified with this element the property is excluded from inserting target if ``insertable `` property within ``@Column `` annotation is ``false ``.
8881
8982.. code-block :: java
9083
9184 @BatchInsert (include = {" name" , " salary" })
9285 int [] insert(List<Employee > employees);
9386
94- SQLファイルによるバッチ挿入
87+ Batch insert by SQL file
9588===========================
9689
97- SQLファイルによるバッチ挿入を行うには、 `` @BatchInsert `` の `` sqlFile `` 要素に `` true `` を設定し、
98- メソッドに対応するSQLファイルを用意します。
90+ To execute batch inserting by SQL file,
91+ you set `` true `` to `` sqlFile `` property within `` @BatchInsert `` annotation and prepare SQL file that correspond method.
9992
10093.. code-block :: java
10194
@@ -105,65 +98,65 @@ SQLファイルによるバッチ挿入を行うには、 ``@BatchInsert`` の `
10598 @BatchInsert (sqlFile = true )
10699 BatchResult<ImmutableEmployee > insert(List<ImmutableEmployee > employees);
107100
108- パラメータは任意の型を要素とする ``java.lang.Iterable `` のサブタイプでなければいけません。
109- 指定できるパラメータの数は1つです。
110- 引数は ``null `` であってはいけません。
111- 戻り値の配列の要素の数はパラメータの ``Iterable `` の要素の数と等しくなります。
112- 配列のそれぞれの要素が更新された件数を返します。
101+ Parameter type must be ``java.lang.Iterable `` subtype that has :doc: ` ../entity ` as an element.
102+ Specifiable parameter is only one.
103+ Parameter must not be ``null ``.
104+ Return value array element count become equal ``Iterable `` element count.
105+ Insert count is returned to array each element.
113106
114- :doc: `../entity ` にエンティティリスナーが指定されていても、エンティティリスナーのメソッドは呼び出しません。
107+ If entity listener is specified at :doc: `../entity ` then entity listener method is not called.
115108
116- たとえば、上記のメソッドに対応するSQLは次のように記述します。
109+ For example, you describe SQL like below to correspond above method.
117110
118111.. code-block :: sql
119112
120113 insert into employee (id, name, salary, version)
121114 values (/* employees.id */0, /* employees.name */'hoge', /* employees.salary */100, /* employees.version */0)
122115
123- SQLファイル上では、パラメータの名前は ``java.lang.Iterable `` のサブタイプの要素を指します。
116+ Parameter name indicate ``java.lang.Iterable `` subtype element in SQL file.
124117
125- SQLファイルによるバッチ挿入では、識別子の自動設定やバージョン番号の自動設定は行われません。
126- また、 ``@BatchInsert `` の `` exclude `` 要素、 `` include `` 要素は参照されません。
118+ Identifier auto setting and version number auto setting are not executed in batch insert by SQL file.
119+ Also, ``exclude `` property and `` include `` property within `` @BatchInsert `` are not referenced.
127120
128- 一意制約違反
129- ============
121+ Unique constraint violation
122+ ============================
130123
131- 一意制約違反が発生した場合は、SQLファイルの使用の有無に関係なく ``UniqueConstraintException `` がスローされます。
124+ ``UniqueConstraintException `` is thrown regardless of with or without using sql file if unique constraint violation is occurred.
132125
133- クエリタイムアウト
126+ Query timeout
134127==================
135128
136- `` @BatchInsert `` の `` queryTimeout `` 要素にクエリタイムアウトの秒数を指定できます。
129+ You can specify seconds of query timeout to `` queryTimeout `` property within `` @BatchInsert `` annotation.
137130
138131.. code-block :: java
139132
140133 @BatchInsert (queryTimeout = 10 )
141134 int [] insert(List<Employee > employees);
142135
143- この指定は、SQLファイルの使用の有無に関係なく適用されます。
144- ``queryTimeout `` 要素に値を指定しない場合、 :doc: ` ../config ` に指定されたクエリタイムアウトが使用されます。
136+ This specifying is applied regardless of with or without using sql file.
137+ Query timeout that is specified in config class is used if ``queryTimeout `` property is not set value.
145138
146- バッチサイズ
139+ Batch size
147140============
148141
149- `` @BatchInsert `` の `` batchSize `` 要素にバッチサイズを指定できます。
142+ You can specify batch size to `` batchSize `` property within `` @BatchInsert `` annotation.
150143
151144.. code-block :: java
152145
153146 @BatchInsert (batchSize = 10 )
154147 int [] insert(List<Employee > employees);
155148
156- この指定は、SQLファイルの使用の有無に関係なく適用されます。
157- ``batchSize `` 要素に値を指定しない場合、 :doc: `../config ` に指定されたバッチサイズが使用されます。
149+ This specify is applied Regardless of using or not using SQL file.
150+ It you do not specify the value to ``batchSize `` property, batch size that is specified at :doc: `../config ` class is applied.
158151
159- SQL のログ出力形式
160- ==================
152+ SQL log output format
153+ =====================
161154
162- `` @BatchInsert `` の `` sqlLog `` 要素に SQL のログ出力形式を指定できます。
155+ You can specify SQL log output format to `` sqlLog `` property within `` @BatchInsert `` annotation.
163156
164157.. code-block :: java
165158
166159 @BatchInsert (sqlLog = SqlLogType . RAW )
167160 int insert(Employee employee);
168161
169- ``SqlLogType.RAW `` はバインドパラメータ(?)付きの SQL をログ出力することを表します。
162+ ``SqlLogType.RAW `` represent outputting log that is sql with a binding parameter.
0 commit comments