Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
//$Id$
2
package org.hibernate.annotations;
3
 
4
import static java.lang.annotation.ElementType.FIELD;
5
import static java.lang.annotation.ElementType.METHOD;
6
import java.lang.annotation.Retention;
7
import static java.lang.annotation.RetentionPolicy.RUNTIME;
8
import javax.persistence.Column;
9
import javax.persistence.FetchType;
10
import static javax.persistence.FetchType.EAGER;
11
 
12
/**
13
 * Define a ToOne association pointing to several entity types.
14
 * Matching the according entity type is doe through a metadata discriminator column
15
 * This kind of mapping should be only marginal.
16
 *
17
 * @author Emmanuel Bernard
18
 */
19
@java.lang.annotation.Target({METHOD, FIELD})
20
@Retention(RUNTIME)
21
public @interface Any {
22
        /**
23
         * Metadata definition used.
24
         * If defined, should point to a @AnyMetaDef name
25
         * If not defined, the local (ie in the same field or property) @AnyMetaDef is used
26
         */
27
        String metaDef() default "";
28
 
29
        /**
30
         * Metadata discriminator column description, This column will hold the meta value corresponding to the
31
         * targeted entity.
32
         */
33
        Column metaColumn();
34
        /**
35
         * Defines whether the value of the field or property should be lazily loaded or must be
36
         * eagerly fetched. The EAGER strategy is a requirement on the persistence provider runtime
37
         * that the value must be eagerly fetched. The LAZY strategy is applied when bytecode
38
         * enhancement is used. If not specified, defaults to EAGER.
39
         */
40
        FetchType fetch() default EAGER;
41
        /**
42
         * Whether the association is optional. If set to false then a non-null relationship must always exist.
43
         */
44
        boolean optional() default true;
45
}