FileDocCategorySizeDatePackage
MappingTableElement.javaAPI DocGlassfish v2 API6856Fri May 04 22:34:44 BST 2007com.sun.jdo.api.persistence.model.mapping

MappingTableElement

public interface MappingTableElement implements MappingMemberElement
This is an element which represents a database table. It exists (separately from TableElement in the database model) to allow the runtime to use a description of the underlying table that differs from the actual database. For example, mapping table contains a key which can be thought of as a "fake primary key" and designates the columns which the runtime will use to identify rows. It is analagous to the primary key of the underlying database table and is typically the same, however the important point is that it is not a requirement. The table in the database may have a different primary key or may have no primary key at all. Similarly, the mapping table contains a list of reference keys which can be thought of as "fake foreign key" objects and designate the column pairs used to join the primary table with a secondary table. These are analagous to foreign keys and may in fact contain identical pairs as the foreign key, but again, this is not a requirement. The foreign key may define a different set of pairs or may not exist at all. Although any set of pairs is legal, the user should be careful to define pairs which represent a logical relationship between the two tables. Any mapping table elements which are designated as primary tables have their key set up automatically. Any mapping table elements which are designated as secondary tables should not have their keys set up directly; the setup is automatically part of the pair definition which makes up the reference key.
author
Mark Munro
author
Rochelle Raccah
version
%I%

Fields Summary
Constructors Summary
Methods Summary
public voidaddKeyColumn(org.netbeans.modules.dbschema.ColumnElement column)
Adds a column to the primary key of columns in this mapping table. This method should only be used to manipulate the key columns of the primary table. The secondary table key columns should be manipulated using MappingReferenceKeyElement methods for pairs.

param
column column element to be added
exception
ModelException if impossible

public voidaddReferencingKey(MappingReferenceKeyElement referencingKey)
Adds a referencing key to the list of keys in this mapping table.

param
referencingKey referencing key element to be added
exception
ModelException if impossible

public java.util.ArrayListgetKey()
Returns the list of column names in the primary key for this mapping table.

return
the names of the columns in the primary key for this mapping table

public java.util.ArrayListgetReferencingKeys()
Returns the list of keys (MappingReferenceKeyElements) for this mapping table. There will be keys for foreign keys and "fake" foreign keys.

return
the reference key elements for this mapping table

public java.lang.StringgetTable()
Returns the name of the table element used by this mapping table.

return
the table name for this mapping table

public booleanisEqual(org.netbeans.modules.dbschema.TableElement table)
Returns true if the table element used by this mapping table is equal to the supplied table.

return
true if table elements are equal, false otherwise.

public voidremoveKeyColumn(java.lang.String columnName)
Removes a column from the primary key of columns in this mapping table. This method should only be used to manipulate the key columns of the primary table. The secondary table key columns should be manipulated using MappingReferenceKeyElement methods for pairs.

param
columnName the relative name of the column to be removed
exception
ModelException if impossible

public voidremoveReference(com.sun.jdo.api.persistence.model.mapping.MappingTableElement table)
Removes the referencing key for the supplied table element from list of keys in this mapping table.

param
table mapping table element for which to remove referencing keys
exception
ModelException if impossible

public voidsetTable(org.netbeans.modules.dbschema.TableElement table)
Set the table element for this mapping table to the supplied table.

param
table table element to be used by the mapping table.
exception
ModelException if impossible