Class TableUtils

java.lang.Object
org.datanucleus.store.rdbms.table.TableUtils

public class TableUtils extends Object
Class containing a series of convenience methods for the generation of tables and constraints.
  • Constructor Details

    • TableUtils

      private TableUtils()
  • Method Details

    • getForeignKeysForReferenceField

      public static Collection<ForeignKey> getForeignKeysForReferenceField(JavaTypeMapping fieldMapping, org.datanucleus.metadata.AbstractMemberMetaData mmd, boolean autoMode, RDBMSStoreManager 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(JavaTypeMapping fieldMapping, org.datanucleus.metadata.AbstractMemberMetaData mmd, boolean autoMode, RDBMSStoreManager 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(Table table, org.datanucleus.metadata.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(Table table, org.datanucleus.metadata.UniqueMetaData umd, JavaTypeMapping fieldMapping)
      Convenience method to return the candidate key (if any) for a field.
      Parameters:
      table - The table
      umd - The Unique MetaData
      fieldMapping - Mapping for the field
      Returns:
      The Candidate Key