Package jakarta.persistence
Annotation Type Basic
-
@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface Basic
The simplest type of mapping to a database column. TheBasicannotation 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 implementsjava.io.Serializable.The use of the
Basicannotation is optional for persistent fields and properties of these types. If theBasicannotation is not specified for such a field or property, the default values of theBasicannotation will apply.Example 1: @Basic protected String name; Example 2: @Basic(fetch=LAZY) protected String getName() { return name; }- Since:
- 1.0
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description FetchTypefetch(Optional) Defines whether the value of the field or property should be lazily loaded or must be eagerly fetched.booleanoptional(Optional) Defines whether the value of the field or property may be null.
-
-
-
Element Detail
-
fetch
FetchType fetch
(Optional) Defines whether the value of the field or property should be lazily loaded or must be eagerly fetched. TheEAGERstrategy is a requirement on the persistence provider runtime that the value must be eagerly fetched. TheLAZYstrategy is a hint to the persistence provider runtime. If not specified, defaults toEAGER.- Default:
- jakarta.persistence.FetchType.EAGER
-
-