View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
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   * Annotation for the join of a relation.
26   * Corresponds to the xml element "join".
27   * 
28   * @version 2.1
29   * @since 2.1
30   */
31  @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) 
32  @Retention(RetentionPolicy.RUNTIME)
33  public @interface Join
34  {
35      /** Table to join to (used when joining to secondary tables). 
36       * @return the table
37       */
38      String table() default "";
39  
40      /** Name of the column in the join table. 
41       * @return the name of the column in the join table
42       */
43      String column() default "";
44  
45      /** Whether the join column is indexed. 
46       * @return whether the join column(s) is(are) indexed
47       */
48      String indexed() default "";
49  
50      /** The name of the index to generate. 
51       * @return the name of the index
52       */
53      String index() default "";
54  
55      /** Whether the join column is unique.
56       * @return whether the join column(s) is(are) is unique
57       */
58      String unique() default "";
59  
60      /**
61       * The name of the unique key constraint to generate.
62       * @return the name of the unique key constraint
63       */
64      String uniqueKey() default "";
65  
66      /** Whether to use an outer join. 
67       * @return whether to use an outer join
68       */
69      String outer() default "";
70  
71      /** Delete action to be applied to any ForeignKey on this join.
72       * @return the delete action
73       */
74      ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED;
75  
76      /** Detail definition of the join column(s). This is needed for
77       * more than one join column.
78       * @return the join columns
79       */
80      Column[] columns() default {};
81  
82      /** Generate or assume a primary key constraint exists on the column
83       * or columns associated with this join. Specify "true" or "false".
84       * @return whether to generate or assume a primary key constraint
85       */
86      String generatePrimaryKey() default "";
87  
88      /** Name for a generated primary key constraint.
89       * @return the name of the generated primary key constraint
90       */
91      String primaryKey() default "";
92  
93      /** Generate or assume a foreign key constraint exists on the column
94       * or columns associated with this join. Specify "true" or "false".
95       * @return whether to generate or assume a foreign key constraint
96       */
97      String generateForeignKey() default "";
98  
99      /** Name for a generated foreign key constraint.
100      * @return the name of the generated foreign key constraint
101      */
102     String foreignKey() default "";
103 
104     /** Vendor extensions.
105      * @return the vendor extensions
106      */
107     Extension[] extensions() default {};
108 }