Interface Table

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Column addColumn​(String storedJavaType, DatastoreIdentifier name, JavaTypeMapping mapping, org.datanucleus.metadata.ColumnMetaData colmd)
      Method to add a new column to the internal representation.
      boolean create​(Connection conn)
      Method to create the table in the datastore representation.
      void drop​(Connection conn)
      Method to drop the table from the datastore representation.
      boolean exists​(Connection conn, boolean create)
      Accessor for whether the table exists in the datastore.
      Column getColumn​(DatastoreIdentifier identifier)
      Accessor for the column with the specified identifier.
      org.datanucleus.metadata.DiscriminatorMetaData getDiscriminatorMetaData()
      Accessor for Discriminator MetaData.
      DatastoreIdentifier getIdentifier()
      Accessor for the identifier for this object.
      JavaTypeMapping getIdMapping()
      Accessor for the ID mapping of this container object.
      JavaTypeMapping getMemberMapping​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
      Accessor for the mapping for the specified FieldMetaData.
      RDBMSStoreManager getStoreManager()  
      JavaTypeMapping getSurrogateMapping​(org.datanucleus.store.schema.table.SurrogateColumnType colType, boolean allowSuperclasses)
      Accessor for the mapping for the specified surrogate type.
      org.datanucleus.metadata.VersionMetaData getVersionMetaData()
      Accessor for the Version MetaData.
      boolean hasColumn​(DatastoreIdentifier identifier)
      Checks if there is a column for the identifier
      void initialize​(org.datanucleus.ClassLoaderResolver clr)
      Method to initialise the table.
      boolean isInitialized()
      Accessor for whether the table has been initialised.
      boolean isInitializedModified()
      Accessor for whether the table has been modified after being initialised.
      boolean isValidated()
      Accessor for whether the table is validated.
      void postInitialize​(org.datanucleus.ClassLoaderResolver clr)
      Post-initialize; for things that must be set after all classes have been initialized.
      void preInitialize​(org.datanucleus.ClassLoaderResolver clr)
      Pre-initialize method; for things that must be initialized right after construction.
      boolean validate​(Connection conn, boolean validateColumnStructure, boolean autoCreate, Collection<Throwable> autoCreateErrors)
      Method to validate the table against what is in the datastore.
      • Methods inherited from interface org.datanucleus.store.schema.table.Table

        getCatalogName, getClassMetaData, getColumnForName, getColumnForPosition, getColumns, getMemberColumnMappingForEmbeddedMember, getMemberColumnMappingForMember, getMemberColumnMappings, getName, getNumberOfColumns, getSchemaName, getSurrogateColumn
    • Method Detail

      • getStoreManager

        RDBMSStoreManager getStoreManager()
        Specified by:
        getStoreManager in interface org.datanucleus.store.schema.table.Table
      • getIdentifier

        DatastoreIdentifier getIdentifier()
        Accessor for the identifier for this object.
        Returns:
        The identifier.
      • addColumn

        Column addColumn​(String storedJavaType,
                         DatastoreIdentifier name,
                         JavaTypeMapping mapping,
                         org.datanucleus.metadata.ColumnMetaData colmd)
        Method to add a new column to the internal representation.
        Parameters:
        storedJavaType - The type of the Java field to store
        name - The name of the column
        mapping - The type mapping for this column
        colmd - The column MetaData
        Returns:
        The new Column
      • hasColumn

        boolean hasColumn​(DatastoreIdentifier identifier)
        Checks if there is a column for the identifier
        Parameters:
        identifier - the identifier of the column
        Returns:
        true if the column exists for the identifier
      • getColumn

        Column getColumn​(DatastoreIdentifier identifier)
        Accessor for the column with the specified identifier. Returns null if has no column of this name.
        Parameters:
        identifier - The name of the column
        Returns:
        The column
      • getIdMapping

        JavaTypeMapping getIdMapping()
        Accessor for the ID mapping of this container object.
        Returns:
        The ID Mapping (if present)
      • getMemberMapping

        JavaTypeMapping getMemberMapping​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
        Accessor for the mapping for the specified FieldMetaData. A datastore container object may store many fields.
        Parameters:
        mmd - Metadata for the field/property
        Returns:
        The Mapping for the member, or null if the FieldMetaData cannot be found
      • getSurrogateMapping

        JavaTypeMapping getSurrogateMapping​(org.datanucleus.store.schema.table.SurrogateColumnType colType,
                                            boolean allowSuperclasses)
        Accessor for the mapping for the specified surrogate type.
        Parameters:
        colType - Column type for the surrogate
        allowSuperclasses - Whether to allow searching superclasses when not specified in this table.
        Returns:
        The mapping
      • getDiscriminatorMetaData

        org.datanucleus.metadata.DiscriminatorMetaData getDiscriminatorMetaData()
        Accessor for Discriminator MetaData.
        Returns:
        Returns the Discriminator MetaData.
      • getVersionMetaData

        org.datanucleus.metadata.VersionMetaData getVersionMetaData()
        Accessor for the Version MetaData.
        Returns:
        Returns the Version MetaData.
      • preInitialize

        void preInitialize​(org.datanucleus.ClassLoaderResolver clr)
        Pre-initialize method; for things that must be initialized right after construction.
        Parameters:
        clr - the ClassLoaderResolver
      • initialize

        void initialize​(org.datanucleus.ClassLoaderResolver clr)
        Method to initialise the table.
        Parameters:
        clr - The ClassLoaderResolver
      • postInitialize

        void postInitialize​(org.datanucleus.ClassLoaderResolver clr)
        Post-initialize; for things that must be set after all classes have been initialized.
        Parameters:
        clr - the ClassLoaderResolver
      • isInitialized

        boolean isInitialized()
        Accessor for whether the table has been initialised.
        Returns:
        Whether it is initialised.
      • isInitializedModified

        boolean isInitializedModified()
        Accessor for whether the table has been modified after being initialised.
        Returns:
        Whether it has been modified after being initialised.
      • validate

        boolean validate​(Connection conn,
                         boolean validateColumnStructure,
                         boolean autoCreate,
                         Collection<Throwable> autoCreateErrors)
                  throws SQLException
        Method to validate the table against what is in the datastore.
        Parameters:
        conn - The connection
        validateColumnStructure - Whether to validate down to the column structure, or just the existence
        autoCreate - Whether to update the table to fix any errors.
        autoCreateErrors - Errors found during the auto-create process
        Returns:
        Whether it validates successfully
        Throws:
        SQLException - Thrown if an error occurrs in the validation
      • isValidated

        boolean isValidated()
        Accessor for whether the table is validated.
        Returns:
        Whether it is validated.
      • exists

        boolean exists​(Connection conn,
                       boolean create)
                throws SQLException
        Accessor for whether the table exists in the datastore. Will throw a MissingTableException if the table doesn't exist.
        Parameters:
        conn - The connecton to use to verify it
        create - Whether to create it if it doesn't exist
        Returns:
        Whether the table was added.
        Throws:
        SQLException - Thrown if an error occurs in the check
      • create

        boolean create​(Connection conn)
                throws SQLException
        Method to create the table in the datastore representation.
        Parameters:
        conn - The connection to use
        Returns:
        true if the table was created
        Throws:
        SQLException - Thrown if an error occurs creating the table.
      • drop

        void drop​(Connection conn)
           throws SQLException
        Method to drop the table from the datastore representation.
        Parameters:
        conn - The connection to use
        Throws:
        SQLException - Thrown if an error occurs