Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
//$Id: ManyToMany.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 many-to-many multiplicity. If the Collection is
14
 * defined using generics to specify the element type, the associated target entity class
15
 * does not need to be specified; otherwise it must be specified.
16
 *
17
 * Every many-to-many association has two sides, the owning side and the non-owning, or inverse,
18
 * side. The join table is specified on the owning side. If the association is bidirectional,
19
 * either side may be designated as the owning side.
20
 *
21
 * The same annotation elements for the OneToMany annotation apply to the ManyToMany annotation.
22
 *
23
 * @author Emmanuel Bernard
24
 */
25
@Target({METHOD, FIELD}) @Retention(RUNTIME)
26
public @interface ManyToMany {
27
        /**
28
         * The entity class that is the target of the association. Optional only if the
29
         * collection property is defined using Java generics. Must be specified otherwise.
30
         *
31
         * Defaults to the parameterized type of the collection when defined using generics.
32
         */
33
        Class targetEntity() default void.class;
34
        /**
35
         * The operations that must be cascaded to the target of the association.
36
         *
37
         * Defaults to no operations being cascaded.
38
         */
39
        CascadeType[] cascade() default {};
40
        /**
41
         * Whether the association should be lazily loaded or must be eagerly fetched.
42
         * The EAGER strategy is a requirement on the persistenceprovider runtime that
43
         * the associatedentities must be eagerly fetched. The LAZY strategy is a hint
44
         * to the persistence provider runtime.
45
         */
46
        FetchType fetch() default LAZY;
47
        /**
48
         * The field that owns the relationship. Required unless the relationship is unidirectional.
49
         */
50
        String mappedBy() default "";
51
}