Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
//$Id: OneToOne.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 that has
14
 * one-to-one multiplicity. It is not normally necessary to specify the associated
15
 * target entity explicitly since it can usually be inferred from the type of the object
16
 * being referenced.
17
 *
18
 * @author Emmanuel Bernard
19
 */
20
@Target({METHOD, FIELD}) @Retention(RUNTIME)
21
public @interface OneToOne {
22
        /**
23
         * The entity class that is the target of the association.
24
         *
25
         * Defaults to the type of the field or property that stores the association.
26
         */
27
        Class targetEntity() default void.class;
28
        /**
29
         * The operations that must be cascaded to the target of the association.
30
         *
31
         * By default no operations are cascaded.
32
         */
33
        CascadeType[] cascade() default {};
34
        /**
35
         * Whether the association should be lazily loaded or must be eagerly fetched.
36
         * The EAGER strategy is a requirement on the persistence provider runtime that
37
         * the associated entity must be eagerly fetched. The LAZY strategy is a hint to
38
         * the persistence provider runtime.
39
         */
40
        FetchType fetch() default EAGER;
41
        /**
42
         * Whether the association is optional. If set to false then a non-null relationship must
43
         * always exist.
44
         */
45
        boolean optional() default true;
46
        /**
47
         * The field that owns the relationship. This element is only specified on the
48
         * inverse (non-owning) side of the association.
49
         */
50
        String mappedBy() default "";
51
}