1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package javax.jdo.annotations;
18
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23
24
25 /**
26 * Annotation for the key of a map relation.
27 * Corresponds to the xml element "key".
28 *
29 * @version 2.1
30 * @since 2.1
31 */
32 @Target({ElementType.FIELD, ElementType.METHOD})
33 @Retention(RetentionPolicy.RUNTIME)
34 public @interface Key
35 {
36 /**
37 * Types of the keys. This can be determined if using JDK1.5 generics
38 * but is required otherwise. Multiple types can be specified if the
39 * implementation supports multiple types.
40 * @return the types of keys
41 */
42 Class[] types() default {};
43
44 /**
45 * Whether the key is to be stored serialized (into a single column of a
46 * join table).
47 * @return whether the key is to be stored serialized
48 */
49 String serialized() default "";
50
51 /** Whether this key is embedded.
52 * @return whether this key is embedded
53 */
54 String embedded() default "";
55
56 /**
57 * The embedded mapping for the key.
58 * @return the embedded mapping for the key
59 */
60 Embedded[] embeddedMapping() default {};
61
62 /**
63 * Whether the key is dependent on the owner (and will be deleted
64 * when the owner is deleted).
65 * @return whether the key is dependent on the owner
66 */
67 String dependent() default "";
68
69 /**
70 * Name of the table for the key.
71 * @return name of the table for the key
72 */
73 String table() default "";
74
75 /**
76 * Name of the column to store the key in.
77 * @return name of the column to store the key in
78 */
79 String column() default "";
80
81 /**
82 * Delete action to apply to the foreign key for the key.
83 * @return delete action to apply to the foreign key for the key
84 */
85 ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED;
86
87 /**
88 * Update action to apply to the foreign key for the key.
89 * @return update action to apply to the foreign key for the key
90 */
91 ForeignKeyAction updateAction() default ForeignKeyAction.UNSPECIFIED;
92
93 /**
94 * Whether the value column(s) should be indexed.
95 * @return whether the value column(s) should be indexed.
96 */
97 String indexed() default "";
98
99 /** The name of the index to generate.
100 * @return the name of the index
101 */
102 String index() default "";
103
104 /**
105 * Whether the element column(s) contents should be considered unique
106 * @return whether the element column(s) contents should be considered unique
107 */
108 String unique() default "";
109
110 /**
111 * The name of the unique key constraint to generate.
112 * @return the name of the unique key constraint
113 */
114 String uniqueKey() default "";
115
116 /**
117 * Name of a member in the value class where this key is stored.
118 * @return the name of a member in the value class where this key is stored
119 */
120 String mappedBy() default "";
121
122 /**
123 * The column(s) for the key
124 * @return the column(s) for the key
125 */
126 Column[] columns() default {};
127
128 /** Generate or assume a foreign key constraint exists on the column
129 * or columns associated with this join. Specify "true" or "false".
130 * @return whether to generate or assume a foreign key constraint
131 */
132 String generateForeignKey() default "";
133
134 /** Name for a generated foreign key constraint.
135 * @return the name of the generated foreign key constraint
136 */
137 String foreignKey() default "";
138
139 /** Vendor extensions.
140 * @return the vendor extensions
141 */
142 Extension[] extensions() default {};
143 }