org.jpox.store.rdbms.table
Class TableUtils

java.lang.Object
  extended byorg.jpox.store.rdbms.table.TableUtils

public class TableUtils
extends java.lang.Object

Class containing a series of convenience methods for the generation of tables and constraints.

Version:
$Revision: 1.5 $

Constructor Summary
TableUtils()
           
 
Method Summary
static CandidateKey getCandidateKeyForField(DatastoreContainerObject table, UniqueMetaData umd, JavaTypeMapping fieldMapping)
          Convenience method to return the candidate key (if any) for a field.
static ForeignKey getForeignKeyForPCField(JavaTypeMapping fieldMapping, AbstractPropertyMetaData fmd, boolean autoMode, StoreManager storeMgr, ClassLoaderResolver clr)
          Convenience method to add a foreign key for a PC field.
static java.util.Collection getForeignKeysForReferenceField(JavaTypeMapping fieldMapping, AbstractPropertyMetaData fmd, boolean autoMode, StoreManager storeMgr, ClassLoaderResolver clr)
          Convenience method to add foreign-keys for the specified reference field.
static Index getIndexForField(DatastoreContainerObject table, IndexMetaData imd, JavaTypeMapping fieldMapping)
          Convenience method to create an Index for a field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableUtils

public TableUtils()
Method Detail

getForeignKeysForReferenceField

public static java.util.Collection getForeignKeysForReferenceField(JavaTypeMapping fieldMapping,
                                                                   AbstractPropertyMetaData fmd,
                                                                   boolean autoMode,
                                                                   StoreManager storeMgr,
                                                                   ClassLoaderResolver clr)
Convenience method to add foreign-keys for the specified reference field. Adds FKs from the column(s) in this table to the ID column(s) of the PC table of the implementation type.

Parameters:
fieldMapping - The field mapping (in this table)
fmd - MetaData for this field
autoMode - Whether we are in auto-create mode
storeMgr - Store Manager
clr - ClassLoader resolver
Returns:
The foreign key(s) created

getForeignKeyForPCField

public static ForeignKey getForeignKeyForPCField(JavaTypeMapping fieldMapping,
                                                 AbstractPropertyMetaData fmd,
                                                 boolean autoMode,
                                                 StoreManager storeMgr,
                                                 ClassLoaderResolver clr)
Convenience method to add a foreign key for a PC field. Adds a FK from the PC column(s) in this table to the ID columns in the PC's table.

Parameters:
fieldMapping - Mapping for the PC field
fmd - MetaData for the field
autoMode - Whether we are in auto-create mode
storeMgr - Store Manager
clr - ClassLoader resolver
Returns:
The ForeignKey (if any)

getIndexForField

public static Index getIndexForField(DatastoreContainerObject table,
                                     IndexMetaData imd,
                                     JavaTypeMapping fieldMapping)
Convenience method to create an Index for a field.

Parameters:
table - Container for the index
imd - The Index MetaData
fieldMapping - Mapping for the field
Returns:
The Index

getCandidateKeyForField

public static CandidateKey getCandidateKeyForField(DatastoreContainerObject table,
                                                   UniqueMetaData umd,
                                                   JavaTypeMapping fieldMapping)
Convenience method to return the candidate key (if any) for a field.

Parameters:
umd - The Unique MetaData
fieldMapping - Mapping for the field
Returns:
The Candidate Key


Copyright © -2007 . All Rights Reserved.