Class ColumnCreator


  • public final class ColumnCreator
    extends Object
    Helper class to create columns. Used for generating columns for join table fields.
    • Method Detail

      • createIndexColumn

        public static Column createIndexColumn​(JavaTypeMapping mapping,
                                               RDBMSStoreManager storeMgr,
                                               org.datanucleus.ClassLoaderResolver clr,
                                               Table table,
                                               org.datanucleus.metadata.ColumnMetaData colmd,
                                               boolean pk)
        Convenience method to add the column for an index mapping.
        Parameters:
        mapping - The mapping
        storeMgr - Manager for the store
        clr - ClassLoaderResolver
        table - Table where we create the column
        colmd - The column MetaData
        pk - Whether this column is (part of) the PK.
        Returns:
        The added column
      • createColumnsForJoinTables

        public static JavaTypeMapping createColumnsForJoinTables​(Class javaType,
                                                                 org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                                 org.datanucleus.metadata.ColumnMetaData[] columnMetaData,
                                                                 RDBMSStoreManager storeMgr,
                                                                 Table table,
                                                                 boolean primaryKey,
                                                                 boolean nullable,
                                                                 org.datanucleus.metadata.FieldRole fieldRole,
                                                                 org.datanucleus.ClassLoaderResolver clr,
                                                                 Table ownerTable)
        Method to create the mapping for a join table for collection element, array element, map key, map value. Supports non-embedded, non-serialised, and must be PC.
        Parameters:
        javaType - The java type of the field
        mmd - Metadata for the field/property
        columnMetaData - MetaData defining the columns
        storeMgr - Store Manager
        table - The table to add the mapping to
        primaryKey - Whether this field is the PK
        nullable - Whether this field is to be nullable
        fieldRole - The role of the mapping within this field
        clr - ClassLoader resolver
        ownerTable - Table of the owner of this field (optional, for the case where the field is embedded so we can link back).
        Returns:
        The java type mapping for this field
      • createColumnsForField

        public static JavaTypeMapping createColumnsForField​(Class javaType,
                                                            JavaTypeMapping mapping,
                                                            Table table,
                                                            RDBMSStoreManager storeMgr,
                                                            org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                            boolean isPrimaryKey,
                                                            boolean isNullable,
                                                            boolean serialised,
                                                            boolean embedded,
                                                            org.datanucleus.metadata.FieldRole fieldRole,
                                                            org.datanucleus.metadata.ColumnMetaData[] columnMetaData,
                                                            org.datanucleus.ClassLoaderResolver clr,
                                                            boolean isReferenceField,
                                                            Table ownerTable)
        Method to create the column(s) for a field in either a join table or for a reference field.
        Parameters:
        javaType - The java type of the field being stored
        mapping - The JavaTypeMapping (if existing, otherwise created and returned by this method)
        table - The table to insert the columns into (join table, or primary table (if ref field))
        storeMgr - Manager for the store
        mmd - MetaData for the field (or null if a collection field)
        isPrimaryKey - Whether to create the columns as part of the PK
        isNullable - Whether the columns should be nullable
        serialised - Whether the field is serialised
        embedded - Whether the field is embedded
        fieldRole - The role of the field (when part of a join table)
        columnMetaData - MetaData for the column(s)
        clr - ClassLoader resolver
        isReferenceField - Whether this field is part of a reference field
        ownerTable - Table of the owner of this member (optional, for when the member is embedded)
        Returns:
        The JavaTypeMapping for the table