KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > model > mapping > MappingRelationshipElement


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * MappingRelationshipElement.java
26  *
27  * Created on March 3, 2000, 1:11 PM
28  */

29
30 package com.sun.jdo.api.persistence.model.mapping;
31
32 import java.util.ArrayList JavaDoc;
33
34 import org.netbeans.modules.dbschema.ColumnPairElement;
35
36 import com.sun.jdo.api.persistence.model.ModelException;
37
38 /**
39  * This is a specialized field element which represents a relationship
40  * between two classes. The mapping portion should be set up as follows:
41  * When mapping a non-join table relationship, call the {@link #addColumn}
42  * method once with each pair of columns between the local table and the
43  * foreign table. When mapping a join table relationship, call the
44  * {@link #addLocalColumn} once for each pair of columns between the
45  * local table and the join table and {@link #addAssociatedColumn} once for
46  * each pair of columns between the join table and the foreign table.
47  * Note that the number of pairs (local and associated) may differ and that
48  * the order of adding them (local first or associated first) is not
49  * important.
50  *
51  * @author Mark Munro
52  * @author Rochelle Raccah
53  * @version %I%
54  */

55 public interface MappingRelationshipElement extends MappingFieldElement
56 {
57     //=================== column handling for join tables ====================
58

59     /** Returns the list of associated column names to which this
60      * mapping field is mapped. This is used for join tables.
61      * @return the names of the columns mapped by this mapping field
62      * @see MappingFieldElement#getColumns
63      */

64     public ArrayList JavaDoc getAssociatedColumns ();
65
66     /** Adds a column to the list of columns mapped by this mapping field.
67      * Call this method instead of <code>addColumn</code> when mapping join
68      * tables. This method is used to map between the local column and the
69      * join table, while <code>addAssociatedColumn</code> is used to
70      * map between the join table and the foreign table.
71      * @param column foreign column element to be added to the mapping
72      * @exception ModelException if impossible
73      * @see MappingFieldElement#addColumn
74      * @see #addAssociatedColumn
75      */

76     public void addLocalColumn (ColumnPairElement column) throws ModelException;
77
78     /** Adds a column to the list of associated columns mapped by this mapping
79      * field. Call this method instead of <code>addColumn</code> when mapping
80      * join tables. This method is used to map between the join table column
81      * and the foreign table column, while <code>addLocalColumn</code> is used
82      * to map between the local table and the join table.
83      * @param column foreign column element to be added to the mapping
84      * @exception ModelException if impossible
85      * @see MappingFieldElement#addColumn
86      * @see #addLocalColumn
87      */

88     public void addAssociatedColumn (ColumnPairElement column)
89         throws ModelException;
90 }
91
Popular Tags