Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
33 | PointedEar | 1 | //$Id: JoinTable.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 | * This annotation is used in the mapping of associations. It is specified on the owning |
||
13 | * side of a many-to-many association, or in a unidirectional one-to-many association. |
||
14 | * |
||
15 | * If the JoinTable annotation is missing, the default values of the annotation elements apply. |
||
16 | * The name of the join table is assumed to be the table names of the associated primary tables |
||
17 | * concatenated together (owning side first) using an underscore. |
||
18 | * |
||
19 | * @author Emmanuel Bernard |
||
20 | */ |
||
21 | @Target({METHOD, FIELD}) @Retention(RUNTIME) |
||
22 | public @interface JoinTable { |
||
23 | /** |
||
24 | * The name of the join table. |
||
25 | * |
||
26 | * Defaults to the concatenated names of the two associated primary entity tables, |
||
27 | * separated by an underscore |
||
28 | */ |
||
29 | String name() default ""; |
||
30 | /** |
||
31 | * The catalog of the table. |
||
32 | * |
||
33 | * Defaults to the default catalog. |
||
34 | */ |
||
35 | String catalog() default ""; |
||
36 | /** |
||
37 | * The schema of the table. |
||
38 | * |
||
39 | * Defaults to the default schema for user. |
||
40 | */ |
||
41 | String schema() default ""; |
||
42 | /** |
||
43 | * The foreign key columns of the join table which reference the primary table of the |
||
44 | * entity owning the association (i.e. the owning side of the association). |
||
45 | * |
||
46 | * Uses the same defaults as for JoinColumn. |
||
47 | */ |
||
48 | JoinColumn[] joinColumns() default {}; |
||
49 | /** |
||
50 | * The foreign key columns of the join table which reference the primary table of the entity |
||
51 | * that does not own the association (i.e. the inverse side of the association). |
||
52 | * |
||
53 | * Uses the same defaults as for JoinColumn |
||
54 | */ |
||
55 | JoinColumn[] inverseJoinColumns() default {}; |
||
56 | /** |
||
57 | * Unique constraints that are to be placed on the table. These are only used if table |
||
58 | * generation is in effect. |
||
59 | * |
||
60 | * Defaults to no additional constraints |
||
61 | */ |
||
62 | UniqueConstraint[] uniqueConstraints() default {}; |
||
63 | } |