org.datanucleus.store.rdbms.table
Class TableUtils

java.lang.Object
  extended by org.datanucleus.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.


Constructor Summary
TableUtils()
           
 
Method Summary
static CandidateKey getCandidateKeyForField(org.datanucleus.store.mapped.DatastoreContainerObject table, org.datanucleus.metadata.UniqueMetaData umd, org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping)
          Convenience method to return the candidate key (if any) for a field.
static ForeignKey getForeignKeyForPCField(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping, org.datanucleus.metadata.AbstractMemberMetaData mmd, boolean autoMode, org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
          Convenience method to add a foreign key for a PC field.
static java.util.Collection getForeignKeysForReferenceField(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping, org.datanucleus.metadata.AbstractMemberMetaData mmd, boolean autoMode, org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr)
          Convenience method to add foreign-keys for the specified reference field.
static Index getIndexForField(org.datanucleus.store.mapped.DatastoreContainerObject table, org.datanucleus.metadata.IndexMetaData imd, org.datanucleus.store.mapped.mapping.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(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
                                                                   org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                                   boolean autoMode,
                                                                   org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                                                                   org.datanucleus.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)
mmd - 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(org.datanucleus.store.mapped.mapping.JavaTypeMapping fieldMapping,
                                                 org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                 boolean autoMode,
                                                 org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                                                 org.datanucleus.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
mmd - 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(org.datanucleus.store.mapped.DatastoreContainerObject table,
                                     org.datanucleus.metadata.IndexMetaData imd,
                                     org.datanucleus.store.mapped.mapping.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(org.datanucleus.store.mapped.DatastoreContainerObject table,
                                                   org.datanucleus.metadata.UniqueMetaData umd,
                                                   org.datanucleus.store.mapped.mapping.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 © 2009. All Rights Reserved.