实体字段的类型必须是 primitives, primitive wrappers, String
s, Date
s, Timestamp
s, 或者是embeddable
身份类identity class
-
必须是 public.
-
必须可以被序列化.
-
必须有无参数的构造函数.
-
The names of the non-static fields or properties of the class must be the same as the names of the identity fields or properties of the corresponding entity class, and the types must be identical.
-
The
equals
andhashCode
methods of the class must use the values of all fields or properties corresponding to identity fields or properties in the entity class. -
If the class is an inner class, it must be
static
. -
All entity classes related by inheritance must use the same identity class, or else each entity class must have its own identity class whose inheritance hierarchy mirrors the inheritance hierarchy of the owning entity classes (see