Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
33 | PointedEar | 1 | //$Id: ManyToOne.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 java.lang.annotation.Retention; |
||
6 | import java.lang.annotation.Target; |
||
7 | |||
8 | import static java.lang.annotation.ElementType.*; |
||
9 | import static java.lang.annotation.RetentionPolicy.*; |
||
10 | import static javax.persistence.FetchType.*; |
||
11 | |||
12 | /** |
||
13 | * This annotation defines a single-valued association to another entity class that has |
||
14 | * many-to-one multiplicity. It is not normally necessary to specify the target entity |
||
15 | * explicitly since it can usually be inferred from the type of the object being referenced. |
||
16 | * |
||
17 | * @author Emmanuel Bernard |
||
18 | */ |
||
19 | @Target({METHOD, FIELD}) @Retention(RUNTIME) |
||
20 | public @interface ManyToOne { |
||
21 | /** |
||
22 | * The entity class that is the target of the association. |
||
23 | * |
||
24 | * Defaults to the type of the field or property that stores the association |
||
25 | */ |
||
26 | Class targetEntity() default void.class; |
||
27 | /** |
||
28 | * The operations that must be cascaded to the target of the association. |
||
29 | * |
||
30 | * By default no operations are cascaded. |
||
31 | */ |
||
32 | CascadeType[] cascade() default {}; |
||
33 | /** |
||
34 | * Whether the association should be lazily loaded or must be eagerly fetched. |
||
35 | * The EAGER strategy is a requirement on the persistence provider runtime that |
||
36 | * the associated entity must be eagerly fetched. The LAZY strategy is a hint to |
||
37 | * the persistence provider runtime. |
||
38 | */ |
||
39 | FetchType fetch() default EAGER; |
||
40 | /** |
||
41 | * Whether the association is optional. If set to false then a non-null relationship must always exist. |
||
42 | */ |
||
43 | boolean optional() default true; |
||
44 | } |