2.5.2.15. Persistent Field Defaults
In the absence of any of the annotations above, JPA defines the following default behavior for declared fields:
-
Fields declared
static, transient, orfinaldefault to non-persistent. -
Fields of any primitive type, primitive wrapper type,
java.lang.String,byte[],Byte[],char[],Character[],java.math.BigDecimal,java.math.BigInteger,java.util.Date,java.util.Calendar,java.sql.Date,java.sql.Timestamp, or anySerializabletype default to persistent, as if annotated with@Basic. -
Fields of an embeddable type default to persistent, as if annotated with
@Embedded. -
All other fields default to non-persistent.
Note that according to these defaults, all relations between entities must be annotated explicitly. Without an annotation, a relation field will default to serialized storage if the related entity type is serializable, or will default to being non-persistent if not.