Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
//$Id: DiscriminatorColumn.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.DiscriminatorType.STRING;
11
 
12
/**
13
 * Is used to define the discriminator column for the SINGLE_TABLE and JOINED inheritance
14
 * mapping strategies.
15
 *
16
 * The strategy and the discriminator column are only specified in the root of an entity
17
 * class hierarchy or subhierarchy in which a different inheritance strategy is applied
18
 *
19
 * If the DiscriminatorColumn annotation is missing, and a discriminator column is required,
20
 * the name of the discriminator column defaults to "DTYPE" and the discriminator type to
21
 * DiscriminatorType.STRING.
22
 *
23
 * @author Emmanuel Bernard
24
 */
25
@Target({TYPE}) @Retention(RUNTIME)
26
public @interface DiscriminatorColumn {
27
        /**
28
         * The name of column to be used for the discriminator.
29
         */
30
        String name() default "DTYPE";
31
        /**
32
         * The type of object/column to use as a class discriminator.
33
         * Defaults to DiscriminatorType.STRING
34
         */
35
        DiscriminatorType discriminatorType() default STRING;
36
        /**
37
         * The SQL fragment that is used when generating the DDL for the discriminator column.
38
         * Defaults to the provider-generated SQL to create a column of the specified
39
         * discriminator type.
40
         */
41
        String columnDefinition() default "";
42
        /**
43
         * The column length for String-based discriminator types. Ignored for other
44
         * discriminator types.
45
         */
46
        int length() default 31;
47
}