1- =========================
2- エンベッダブルクラス
3- =========================
1+ ==================
2+ Embeddable classes
3+ ==================
44
5- .. contents :: 目次
5+ .. contents ::
66 :depth: 3
77
8- Embeddable(エンベッダブル)は、データベースのテーブルやクエリの結果セット複数カラムをグループ化します。
8+ Embeddable classes group the properties for :doc: ` ../entity `.
99
10- エンベッダブル定義
11- =========================
10+ Embeddable definition
11+ =====================
1212
13- エンベッダブルクラスは ``@Enbeddable `` を注釈して示します。
14- コンストラクタには永続的なフィールドに対応するパラメータが必要です。
13+ The following code snippet shows how to define an embeddable:
1514
1615.. code-block :: java
1716
18- @Embeddalbe
17+ @Embeddable
1918 public class Address {
2019
2120 final String city;
@@ -32,7 +31,7 @@ Embeddable(エンベッダブル)は、データベースのテーブルや
3231 }
3332 }
3433
35- エンベッダブルクラスは :doc: ` ../ entity` のフィールドとして使用します。
34+ The embeddable class is used as the entity field type:
3635
3736.. code-block :: java
3837
@@ -44,7 +43,7 @@ Embeddable(エンベッダブル)は、データベースのテーブルや
4443 Address address;
4544 }
4645
47- テーブルや結果セットとのマッピングにおいて、上記のクラス定義は下記のクラス定義と同等です。
46+ The above entity definition is equivalent to following one:
4847
4948.. code-block :: java
5049
@@ -62,80 +61,59 @@ Embeddable(エンベッダブル)は、データベースのテーブルや
6261 }
6362
6463
65- ネーミング規約
66- ---------------------------
64+ Naming convention
65+ -----------------
6766
68- ネーミング規約は、エンベッダブルクラスを保有する :doc: `../entity ` から引き継ぎます。
67+ A naming convention is inherited from the enclosing :doc: `../entity `.
6968
70- フィールド定義
71- ==================
69+ Field definition
70+ ================
71+
72+ By default, the fields are persistent and correspond to the database columns or result set columns.
7273
73- エンベッダブルクラスのフィールドはデフォルトで永続的です。
74- つまり、テーブルや結果セットのカラムに対応します。
75- フィールドの型は次のいずれかでなければいけません。
74+ The field type must be one of the following:
7675
7776* :doc: `basic `
7877* :doc: `domain `
79- * :doc: `basic ` または :doc: `domain ` のいずれかを要素とするjava.util.Optional
78+ * java.util.Optional, whose element is either :doc: `basic ` or :doc: `domain `
8079* java.util.OptionalInt
8180* java.util.OptionalLong
8281* java.util.OptionalDouble
8382
8483.. code-block :: java
8584
86- @Embeddalbe
85+ @Embeddable
8786 public class Address {
8887 ...
8988 String street;
9089 }
9190
92- カラム
93- ------------------
91+ Column
92+ ------
9493
95- カラム情報を指定するには、 ``@Column `` を使用します。
94+ You can specify the corresponding column name with the ``@Column `` annotation:
9695
9796.. code-block :: java
9897
9998 @Column (name = " ZIP_CODE" )
10099 final String zip;
101100
102- 識別子
103- ------
104-
105- エンベッダブルクラスには識別子(主キー)を定義できません。
106-
107- バージョン
108- ------------------
101+ Transient
102+ ---------
109103
110- エンベッダブルクラスには楽観的排他制御用のバージョンを定義できません。
104+ If an embeddable has fields that you don’t want to persist, you can annotate them using `` @Transient ``:
111105
112- 非永続的なフィールド
113- --------------------------------
106+ Method definition
107+ =================
114108
115- 非永続的なフィールドは、``@Transient `` を注釈して示します。
116-
117- 取得時の状態を管理するフィールド
118- --------------------------------------------
119-
120- エンベッダブルクラスには取得時の状態を管理するフィールドを定義できません。
121-
122- メソッド定義
123- ==================
124-
125- メソッドの定義に制限はありません。
126-
127- フィールドの可視性を ``protected `` やパッケージプライベートにして ``public `` なメソッド経由で
128- アクセスすることも、メソッドを一切使用せず ``public `` フィールドに直接アクセスすること
129- もどちらもサポートされています。
130-
131- 利用例
132- ==================
109+ There are no limitations in the use of methods.
133110
134- インスタンス化して利用します。
111+ Example
112+ =======
135113
136114.. code-block :: java
137115
138- Employee employee = new Employee (); // エンティティ
139- Address address = new Address (" Tokyo" , " Yaesu" , " 103-0028" ); // エンベッダブル
116+ Employee employee = new Employee (); // Entity
117+ Address address = new Address (" Tokyo" , " Yaesu" , " 103-0028" ); // Embeddable
140118 employee. setAddress(address);
141119
0 commit comments