Skip to content

Commit ef90a48

Browse files
committed
Document that the auto-generated value is set only if the identity field is either null or less than 0
1 parent 4e92c3f commit ef90a48

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

docs/sources/entity.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ Entity(エンティティ)は、データベースのテーブルやクエ
185185

186186
フィールドの型が :doc:`embeddable` の場合、 ``@Id`` は指定できません。
187187

188+
.. _identity-auto-generation:
189+
188190
識別子の自動生成
189191
~~~~~~~~~~~~~~~~
190192

@@ -201,7 +203,8 @@ Entity(エンティティ)は、データベースのテーブルやクエ
201203

202204
.. note::
203205

204-
プリミティブ型を使う場合、自動生成された値が確実に設定されるようにするには初期値に ``-1`` など ``0`` 未満の値を明示してください。
206+
自動生成された値が識別子フィールドに設定される条件は、フィールドの値が ``null`` もしくは ``0`` 未満であることです。
207+
プリミティブ型を使う場合は、フィールドの初期値に ``-1`` など ``0`` 未満の値を明示してください。
205208

206209
IDENTITYを使った識別子の自動生成
207210
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

docs/sources/query/batch-insert.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ SQLの自動生成によるバッチ挿入
4949
:doc:`../entity` の識別子に、 ``@GeneratedValue`` が注釈されている場合、
5050
識別子が自動的に生成され設定されます。
5151

52+
注意点については :ref:`identity-auto-generation` を参照ください。
53+
5254
バージョン番号
5355
--------------
5456

docs/sources/query/insert.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ SQLの自動生成による挿入
5555
:doc:`../entity` の識別子に、 ``@GeneratedValue`` が注釈されている場合、
5656
識別子が自動的に生成され設定されます。
5757

58+
注意点については :ref:`identity-auto-generation` を参照ください。
59+
5860
バージョン番号
5961
--------------
6062

0 commit comments

Comments
 (0)