Class TableUtils
java.lang.Object
org.datanucleus.store.rdbms.table.TableUtils
Class containing a series of convenience methods for the generation of tables and constraints.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
<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.static Index
getIndexForField
(Table table, org.datanucleus.metadata.IndexMetaData imd, JavaTypeMapping fieldMapping) Convenience method to create an Index for a field.
-
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 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
-