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.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CandidateKey
getCandidateKeyForField(Table table, org.datanucleus.metadata.UniqueMetaData umd, JavaTypeMapping fieldMapping)
Convenience method to return the candidate key (if any) for a field.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.static Collection
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.static Index
getIndexForField(Table table, org.datanucleus.metadata.IndexMetaData imd, JavaTypeMapping fieldMapping)
Convenience method to create an Index for a field.
-
-
-
Method Detail
-
getForeignKeysForReferenceField
public static Collection 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 fieldautoMode
- Whether we are in auto-create modestoreMgr
- Store Managerclr
- 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 fieldmmd
- MetaData for the fieldautoMode
- Whether we are in auto-create modestoreMgr
- Store Managerclr
- 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 indeximd
- The Index MetaDatafieldMapping
- 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 tableumd
- The Unique MetaDatafieldMapping
- Mapping for the field- Returns:
- The Candidate Key
-
-