Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
33 | PointedEar | 1 | //$Id: OneToMany.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 | * Defines a many-valued association with one-to-many multiplicity. |
||
14 | * |
||
15 | * If the collection is defined using generics to specify the element type, |
||
16 | * the associated target entity type need not be specified; otherwise the target |
||
17 | * entity class must be specified. |
||
18 | * |
||
19 | * @author Emmanuel Bernard |
||
20 | */ |
||
21 | @Target({METHOD, FIELD}) @Retention(RUNTIME) |
||
22 | public @interface OneToMany { |
||
23 | /** |
||
24 | * The entity class that is the target of the association. Optional only if the collection |
||
25 | * property is defined using Java generics. Must be specified otherwise. |
||
26 | * |
||
27 | * Defaults to the parameterized type of the collection when defined using generics. |
||
28 | */ |
||
29 | Class targetEntity() default void.class; |
||
30 | /** |
||
31 | * The operations that must be cascaded to the target of the association. |
||
32 | * |
||
33 | * Defaults to no operations being cascaded. |
||
34 | */ |
||
35 | CascadeType[] cascade() default {}; |
||
36 | /** |
||
37 | * Whether the association should be lazily loaded or must be eagerly fetched. |
||
38 | * The EAGER strategy is a requirement on the persistenceprovider runtime that the |
||
39 | * associatedentities must be eagerly fetched. The LAZY strategy is a hint to the |
||
40 | * persistence provider runtime. |
||
41 | */ |
||
42 | FetchType fetch() default LAZY; |
||
43 | /** |
||
44 | * The field that owns the relationship. Required unless the relationship is unidirectional. |
||
45 | */ |
||
46 | String mappedBy() default ""; |
||
47 | } |