Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
33 | PointedEar | 1 | //$Id: Column.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 | |||
11 | /** |
||
12 | * Is used to specify a mapped column for a persistent property or field. If no Column annotation is |
||
13 | * specified, the default values are applied. |
||
14 | * |
||
15 | * @author Emmanuel Bernard |
||
16 | */ |
||
17 | @Target({METHOD, FIELD}) @Retention(RUNTIME) |
||
18 | public @interface Column { |
||
19 | /** |
||
20 | * The name of the column. Defaults to the property or field name |
||
21 | */ |
||
22 | String name() default ""; |
||
23 | /** |
||
24 | * Whether the property is a unique key. This is a shortcut for the UniqueConstraint |
||
25 | * annotation at the table level and is useful for when the unique key constraint is |
||
26 | * only a single field. This constraint applies in addition to any constraint entailed |
||
27 | * by primary key mapping and to constraints specified at the table level. |
||
28 | */ |
||
29 | boolean unique() default false; |
||
30 | /** |
||
31 | * Whether the database column is nullable |
||
32 | */ |
||
33 | boolean nullable() default true; |
||
34 | /** |
||
35 | * Whether the column is included in SQL INSERT statements generated by the persistence provider. |
||
36 | */ |
||
37 | boolean insertable() default true; |
||
38 | /** |
||
39 | * Whether the column is included in SQL UPDATE statements generated by the persistence provider. |
||
40 | */ |
||
41 | boolean updatable() default true; |
||
42 | /** |
||
43 | * The SQL fragment that is used when generating the DDL for the column. |
||
44 | * Defaults to the generated SQL to create a column of the inferred type. |
||
45 | */ |
||
46 | String columnDefinition() default ""; |
||
47 | /** |
||
48 | * The name of the table that contains the column. If absent the column is assumed to |
||
49 | * be in the primary table. |
||
50 | */ |
||
51 | String table() default ""; |
||
52 | /** |
||
53 | * The column length. (Applies only if a string-valued column is used.) |
||
54 | */ |
||
55 | int length() default 255; |
||
56 | /** |
||
57 | * The precision for a decimal (exact numeric) column. (Applies only if a decimal column is used.) |
||
58 | * Value must be set by developer if used when generating the DDL for the column. |
||
59 | */ |
||
60 | int precision() default 0; |
||
61 | /** |
||
62 | * The scale for a decimal (exact numeric) column. (Applies only if a decimal column is used.) |
||
63 | */ |
||
64 | int scale() default 0; |
||
65 | } |