Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
33 | PointedEar | 1 | //$Id: Basic.java 11282 2007-03-14 22:05:59Z epbernard $ |
2 | //EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc. |
||
3 | package javax.persistence; |
||
4 | |||
5 | import static java.lang.annotation.ElementType.FIELD; |
||
6 | import static java.lang.annotation.ElementType.METHOD; |
||
7 | import java.lang.annotation.Retention; |
||
8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; |
||
9 | import java.lang.annotation.Target; |
||
10 | import static javax.persistence.FetchType.EAGER; |
||
11 | |||
12 | /** |
||
13 | * The Basic annotation is the simplest type of mapping to a database column. The Basic |
||
14 | * annotation can be applied to a persistent property or instance variable of any of the |
||
15 | * following types: Java primitive types, wrappers of the primitive types, String, |
||
16 | * java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar, |
||
17 | * java.sql.Date, java.sql.Time, java.sql.Timestamp, byte[], Byte[], char[], Character[], |
||
18 | * enums, and any other type that implements Serializable. |
||
19 | * |
||
20 | * The use of the Basic annotation is optional for persistent fields and properties of these types. |
||
21 | |||
22 | * @author Emmanuel Bernard |
||
23 | */ |
||
24 | @Target({METHOD, FIELD}) @Retention(RUNTIME) |
||
25 | public @interface Basic { |
||
26 | /** |
||
27 | * Defines whether the value of the field or property should be lazily loaded or must be |
||
28 | * eagerly fetched. The EAGER strategy is a requirement on the persistence provider runtime |
||
29 | * that the value must be eagerly fetched. The LAZY strategy is a hint to the persistence |
||
30 | * provider runtime. If not specified, defaults to EAGER. |
||
31 | */ |
||
32 | FetchType fetch() default EAGER; |
||
33 | /** |
||
34 | * Defines whether the value of the field or property may be null. This is a hint and is |
||
35 | * disregarded for primitive types; it may be used in schema generation. If not specified, |
||
36 | * defaults to true. |
||
37 | */ |
||
38 | boolean optional() default true; |
||
39 | } |