Basic annotation can be applied to a persistent
property or instance variable of any of the following types: Java
primitive types, wrappers of the primitive types, String,
java.math.BigInteger,
java.math.BigDecimal,
java.util.Date,
java.util.Calendar,
java.sql.Date,
java.sql.Time,
java.sql.Timestamp, byte[], Byte[],
char[], Character[], enums, and any other type that
implements java.io.Serializable.
The use of the Basic annotation is optional for
persistent fields and properties of these types. If the
Basic annotation is not specified for such a field or
property, the default values of the Basic annotation
will apply.
Example 1:
@Basic
protected String name;
Example 2:
@Basic(fetch=LAZY)
protected String getName() { return name; }
| Modifier and Type | Method and Description |
|---|---|
| public FetchType | fetch()
(Optional) Defines whether the value of the field or property should be lazily loaded or must be eagerly fetched. |
| public boolean |
| fetch | back to summary |
|---|---|
| public FetchType fetch() (Optional) Defines whether the value of the field or property should
be lazily loaded or must be eagerly fetched. The | |
| optional | back to summary |
|---|---|
| public boolean optional() (Optional) Defines whether the value of the field or property may be null.
This is a hint and is disregarded for primitive types; it may
be used in schema generation.
If not specified, defaults to | |