Class RDBMSStoreManager

  • All Implemented Interfaces:
    org.datanucleus.store.BackedSCOStoreManager, org.datanucleus.store.schema.SchemaAwareStoreManager, org.datanucleus.store.schema.SchemaScriptAwareStoreManager, org.datanucleus.store.StoreManager

    public class RDBMSStoreManager
    extends org.datanucleus.store.AbstractStoreManager
    implements org.datanucleus.store.BackedSCOStoreManager, org.datanucleus.store.schema.SchemaAwareStoreManager, org.datanucleus.store.schema.SchemaScriptAwareStoreManager
    StoreManager for RDBMS datastores. Provided by the "store-manager" extension key "rdbms" and accepts datastore URLs valid for JDBC.

    The RDBMS manager's responsibilities extend those for StoreManager to add :

    • creates and controls access to the data sources required for this datastore instance
    • implements insert(), fetch(), update(), delete() in the interface to the ObjectProvider.
    • Providing cached access to JDBC database metadata (in particular column information).
    • Resolving SQL identifier macros to actual SQL identifiers.
    TODO Change RDBMSManager to share schema information (DatabaseMetaData) with other RDBMSManager.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String catalogName
      Catalog name for the database (if supported).
      protected DatastoreAdapter dba
      Adapter for the datastore being used.
      protected SQLExpressionFactory expressionFactory
      Factory for expressions using the generic query SQL mechanism.
      protected IdentifierFactory identifierFactory
      Factory for identifiers for this datastore.
      protected Map<org.datanucleus.state.ObjectProvider,​DatastoreClass> insertedDatastoreClassByObjectProvider
      Map of DatastoreClass keyed by ObjectProvider, for objects currently being inserted.
      protected MappingManager mappingManager
      Manager for the mapping between Java and datastore types.
      static String METADATA_NONDURABLE_REQUIRES_TABLE  
      protected ReadWriteLock schemaLock
      Lock object aimed at providing a lock on the schema definition managed here, preventing reads while it is being updated etc.
      protected String schemaName
      Schema name for the database (if supported).
      • Fields inherited from class org.datanucleus.store.AbstractStoreManager

        connectionMgr, flushProcess, namingFactory, nucleusContext, persistenceHandler, queryMgr, schemaHandler, storeDataMgr, storeManagerKey, valueGenerationMgr
      • Fields inherited from class org.datanucleus.properties.PropertyStore

        frequentProperties, properties
      • Fields inherited from interface org.datanucleus.store.StoreManager

        OPTION_APPLICATION_COMPOSITE_ID, OPTION_APPLICATION_ID, OPTION_DATASTORE_ID, OPTION_DATASTORE_TIME_STORES_MILLISECS, OPTION_DATASTORE_TIME_STORES_NANOSECS, OPTION_DATASTORE_TIMEOUT, OPTION_NONDURABLE_ID, OPTION_ORM, OPTION_ORM_EMBEDDED_ARRAY, OPTION_ORM_EMBEDDED_ARRAY_NESTED, OPTION_ORM_EMBEDDED_COLLECTION, OPTION_ORM_EMBEDDED_COLLECTION_NESTED, OPTION_ORM_EMBEDDED_MAP, OPTION_ORM_EMBEDDED_MAP_NESTED, OPTION_ORM_EMBEDDED_PC, OPTION_ORM_EMBEDDED_PC_NESTED, OPTION_ORM_FOREIGN_KEYS, OPTION_ORM_INHERITANCE_COMPLETE_TABLE, OPTION_ORM_INHERITANCE_JOINED_TABLE, OPTION_ORM_INHERITANCE_SINGLE_TABLE, OPTION_ORM_SECONDARY_TABLE, OPTION_ORM_SERIALISED_ARRAY_ELEMENT, OPTION_ORM_SERIALISED_COLLECTION_ELEMENT, OPTION_ORM_SERIALISED_MAP_KEY, OPTION_ORM_SERIALISED_MAP_VALUE, OPTION_ORM_SERIALISED_PC, OPTION_QUERY_CANCEL, OPTION_QUERY_JDOQL_BITWISE_OPS, OPTION_QUERY_JDOQL_BULK_DELETE, OPTION_QUERY_JDOQL_BULK_INSERT, OPTION_QUERY_JDOQL_BULK_UPDATE, OPTION_QUERY_JPQL_BULK_DELETE, OPTION_QUERY_JPQL_BULK_INSERT, OPTION_QUERY_JPQL_BULK_UPDATE, OPTION_TRANSACTION_ACID, OPTION_TXN_ISOLATION_READ_COMMITTED, OPTION_TXN_ISOLATION_READ_UNCOMMITTED, OPTION_TXN_ISOLATION_REPEATABLE_READ, OPTION_TXN_ISOLATION_SERIALIZABLE, RELATION_IDENTITY_STORAGE_PERSISTABLE_IDENTITY
    • Constructor Summary

      Constructors 
      Constructor Description
      RDBMSStoreManager​(org.datanucleus.ClassLoaderResolver clr, org.datanucleus.PersistenceNucleusContext ctx, Map<String,​Object> props)
      Constructs a new RDBMSManager.
    • Field Detail

      • identifierFactory

        protected IdentifierFactory identifierFactory
        Factory for identifiers for this datastore.
      • catalogName

        protected String catalogName
        Catalog name for the database (if supported).
      • schemaName

        protected String schemaName
        Schema name for the database (if supported).
      • mappingManager

        protected MappingManager mappingManager
        Manager for the mapping between Java and datastore types.
      • insertedDatastoreClassByObjectProvider

        protected Map<org.datanucleus.state.ObjectProvider,​DatastoreClass> insertedDatastoreClassByObjectProvider
        Map of DatastoreClass keyed by ObjectProvider, for objects currently being inserted. Defines to what level an object is inserted in the datastore.
      • schemaLock

        protected ReadWriteLock schemaLock
        Lock object aimed at providing a lock on the schema definition managed here, preventing reads while it is being updated etc.
      • expressionFactory

        protected SQLExpressionFactory expressionFactory
        Factory for expressions using the generic query SQL mechanism.
    • Constructor Detail

      • RDBMSStoreManager

        public RDBMSStoreManager​(org.datanucleus.ClassLoaderResolver clr,
                                 org.datanucleus.PersistenceNucleusContext ctx,
                                 Map<String,​Object> props)
        Constructs a new RDBMSManager. On successful return the new RDBMSManager will have successfully connected to the database with the given credentials and determined the schema name, but will not have inspected the schema contents any further. The contents (tables, views, etc.) will be subsequently created and/or validated on-demand as the application accesses persistent classes.
        Parameters:
        clr - the ClassLoaderResolver
        ctx - The corresponding Context. This factory's non-tx data source will be used to get database connections as needed to perform management functions.
        props - Properties for the datastore
        Throws:
        org.datanucleus.exceptions.NucleusDataStoreException - If the database could not be accessed or the name of the schema could not be determined.
    • Method Detail

      • getQueryCacheKey

        public String getQueryCacheKey()
        Specified by:
        getQueryCacheKey in interface org.datanucleus.store.StoreManager
      • initialiseIdentifierFactory

        protected void initialiseIdentifierFactory​(org.datanucleus.NucleusContext nucleusContext)
        Method to create the IdentifierFactory to be used by this store. Relies on the datastore adapter existing before creation
        Parameters:
        nucleusContext - context
      • getIdentifierFactory

        public IdentifierFactory getIdentifierFactory()
        Accessor for the factory for creating identifiers (table/column names etc).
        Returns:
        Identifier factory
      • getDatastoreAdapter

        public DatastoreAdapter getDatastoreAdapter()
        Gets the DatastoreAdapter to use for this store.
        Returns:
        Returns the DatastoreAdapter
      • getMappingManager

        public MappingManager getMappingManager()
        Gets the MappingManager to use for this store.
        Returns:
        Returns the MappingManager.
      • getDefaultObjectProviderClassName

        public String getDefaultObjectProviderClassName()
        Specified by:
        getDefaultObjectProviderClassName in interface org.datanucleus.store.StoreManager
        Overrides:
        getDefaultObjectProviderClassName in class org.datanucleus.store.AbstractStoreManager
      • getStoreDataForDatastoreContainerObject

        public org.datanucleus.store.StoreData[] getStoreDataForDatastoreContainerObject​(DatastoreIdentifier tableIdentifier)
        Utility to return all StoreData for a Datastore Container identifier. Returns StoreData with this table identifier and where the class is the owner of the table.
        Parameters:
        tableIdentifier - Identifier for the table
        Returns:
        The StoreData for this table (if managed).
      • getTable

        public Table getTable​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
        Returns the datastore container (table) for the specified field. Returns 'null' if the field is not (yet) known to the store manager. Note : if we have an embedded object (embedded into something else) that has a member which requires a join table, then this method will not cater for having different tables for the different places that the object can be embedded.
        Parameters:
        mmd - The metadata for the field.
        Returns:
        The corresponding datastore container, or 'null'.
      • getDatastoreClass

        public DatastoreClass getDatastoreClass​(String className,
                                                org.datanucleus.ClassLoaderResolver clr)
        Returns the primary datastore table serving as backing for the given class. If the class is not yet known to the store manager, manageClasses(org.datanucleus.ClassLoaderResolver, java.lang.String...) is called to add it. Classes which have inheritance strategy of "new-table" and "superclass-table" will return a table here, whereas "subclass-table" will return null since it doesn't have a table as such.

        Parameters:
        className - Name of the class whose table is be returned.
        clr - The ClassLoaderResolver
        Returns:
        The corresponding class table.
        Throws:
        NoTableManagedException - If the given class has no table managed in the database.
      • getDatastoreClass

        public DatastoreClass getDatastoreClass​(DatastoreIdentifier name)
        Returns the datastore table having the given identifier. Returns 'null' if no such table is (yet) known to the store manager.
        Parameters:
        name - The identifier name of the table.
        Returns:
        The corresponding table, or 'null'
      • getClassesManagingTableForClass

        public org.datanucleus.metadata.AbstractClassMetaData[] getClassesManagingTableForClass​(org.datanucleus.metadata.AbstractClassMetaData cmd,
                                                                                                org.datanucleus.ClassLoaderResolver clr)
        Method to return the class(es) that has a table managing the persistence of the fields of the supplied class. For the 3 inheritance strategies, the following occurs :-
        • new-table : will return the same ClassMetaData
        • subclass-table : will return all subclasses that have a table managing its fields
        • superclass-table : will return the next superclass that has a table
        Parameters:
        cmd - The supplied class.
        clr - ClassLoader resolver
        Returns:
        The ClassMetaData's managing the fields of the supplied class
      • isObjectInserted

        public boolean isObjectInserted​(org.datanucleus.state.ObjectProvider op,
                                        int fieldNumber)
        Accessor for whether the specified field of the object is inserted in the datastore yet.
        Parameters:
        op - ObjectProvider for the object
        fieldNumber - (Absolute) field number for the object
        Returns:
        Whether it is persistent
      • isObjectInserted

        public boolean isObjectInserted​(org.datanucleus.state.ObjectProvider op,
                                        String className)
        Returns whether this object is inserted in the datastore far enough to be considered to be the supplied type. For example if we have base class A, B extends A and this object is a B, and we pass in A here then this returns whether the A part of the object is now inserted.
        Parameters:
        op - ObjectProvider for the object
        className - Name of class that we want to check the insertion level for.
        Returns:
        Whether the object is inserted in the datastore to this level
      • setObjectIsInsertedToLevel

        public void setObjectIsInsertedToLevel​(org.datanucleus.state.ObjectProvider op,
                                               DatastoreClass table)
        Method to set that the specified object is inserted down to the defined datastore class. When the object is fully inserted (the table is the primary table for this object type) it is removed from the map of objects being inserted.
        Parameters:
        op - ObjectProvider for the object
        table - Table to which it is now inserted
      • getExistingBackingStoreForMember

        public org.datanucleus.store.types.scostore.Store getExistingBackingStoreForMember​(org.datanucleus.metadata.AbstractMemberMetaData mmd)
      • getBackingStoreForField

        public org.datanucleus.store.types.scostore.Store getBackingStoreForField​(org.datanucleus.ClassLoaderResolver clr,
                                                                                  org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                                                  Class type)
        Accessor for the backing store for the specified member. Note : if we have an embedded object that is embedded into some other type and the object has a member that requires a join table (backing store), this method will not cater for the different places that can be embedded.
        Specified by:
        getBackingStoreForField in interface org.datanucleus.store.BackedSCOStoreManager
        Parameters:
        clr - The ClassLoaderResolver
        mmd - metadata for the member to be persisted by this Store
        type - instantiated type or prefered type
        Returns:
        The backing store
      • getDefaultIdentifierCase

        public String getDefaultIdentifierCase()
        Method to return the default identifier case.
        Returns:
        Identifier case to use if not specified by the user
      • getSchemaCallbacks

        public org.datanucleus.util.MultiMap getSchemaCallbacks()
      • addSchemaCallback

        public void addSchemaCallback​(String className,
                                      org.datanucleus.metadata.AbstractMemberMetaData mmd)
      • isJdbcStore

        public boolean isJdbcStore()
        Specified by:
        isJdbcStore in interface org.datanucleus.store.StoreManager
        Overrides:
        isJdbcStore in class org.datanucleus.store.AbstractStoreManager
      • getNativeQueryLanguage

        public String getNativeQueryLanguage()
        Specified by:
        getNativeQueryLanguage in interface org.datanucleus.store.StoreManager
      • getSupportedQueryLanguages

        public Collection<String> getSupportedQueryLanguages()
        Specified by:
        getSupportedQueryLanguages in interface org.datanucleus.store.StoreManager
        Overrides:
        getSupportedQueryLanguages in class org.datanucleus.store.AbstractStoreManager
      • supportsQueryLanguage

        public boolean supportsQueryLanguage​(String language)
        Specified by:
        supportsQueryLanguage in interface org.datanucleus.store.StoreManager
        Overrides:
        supportsQueryLanguage in class org.datanucleus.store.AbstractStoreManager
      • newQuery

        public org.datanucleus.store.query.Query newQuery​(String language,
                                                          org.datanucleus.ExecutionContext ec)
        Specified by:
        newQuery in interface org.datanucleus.store.StoreManager
      • newQuery

        public org.datanucleus.store.query.Query newQuery​(String language,
                                                          org.datanucleus.ExecutionContext ec,
                                                          String queryString)
        Specified by:
        newQuery in interface org.datanucleus.store.StoreManager
      • newQuery

        public org.datanucleus.store.query.Query newQuery​(String language,
                                                          org.datanucleus.ExecutionContext ec,
                                                          org.datanucleus.store.query.Query q)
        Specified by:
        newQuery in interface org.datanucleus.store.StoreManager
      • logConfiguration

        protected void logConfiguration()
        Convenience method to log the configuration of this store manager.
        Overrides:
        logConfiguration in class org.datanucleus.store.AbstractStoreManager
      • close

        public void close()
        Release of resources
        Specified by:
        close in interface org.datanucleus.store.StoreManager
        Overrides:
        close in class org.datanucleus.store.AbstractStoreManager
      • getNucleusSequence

        public org.datanucleus.store.NucleusSequence getNucleusSequence​(org.datanucleus.ExecutionContext ec,
                                                                        org.datanucleus.metadata.SequenceMetaData seqmd)
        Method to return a datastore sequence for this datastore matching the passed sequence MetaData.
        Specified by:
        getNucleusSequence in interface org.datanucleus.store.StoreManager
        Parameters:
        ec - execution context
        seqmd - SequenceMetaData
        Returns:
        The Sequence
      • getSQLController

        public SQLController getSQLController()
        Accessor for the SQL controller.
        Returns:
        The SQL controller
      • getSQLExpressionFactory

        public SQLExpressionFactory getSQLExpressionFactory()
        Accessor for the SQL expression factory to use when generating SQL statements.
        Returns:
        SQL expression factory
      • getCatalogName

        public String getCatalogName()
        Accessor for the (default) RDBMS catalog name.
        Returns:
        The catalog name.
      • getSchemaName

        public String getSchemaName()
        Accessor for the (default) RDBMS schema name.
        Returns:
        The schema name.
      • getDatastoreDate

        public Date getDatastoreDate()
        Get the date/time of the datastore.
        Specified by:
        getDatastoreDate in interface org.datanucleus.store.StoreManager
        Returns:
        Date/time of the datastore
      • manageClasses

        public void manageClasses​(org.datanucleus.ClassLoaderResolver clr,
                                  String... classNames)
        Method to add several persistable classes to the store manager's set of supported classes. This will create any necessary database objects (tables, views, constraints, indexes etc). This will also cause the addition of any related classes.
        Specified by:
        manageClasses in interface org.datanucleus.store.StoreManager
        Overrides:
        manageClasses in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        clr - The ClassLoaderResolver
        classNames - Name of the class(es) to be added.
      • unmanageAllClasses

        public void unmanageAllClasses​(org.datanucleus.ClassLoaderResolver clr)
        Utility to remove all classes that we are managing.
        Specified by:
        unmanageAllClasses in interface org.datanucleus.store.StoreManager
        Overrides:
        unmanageAllClasses in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        clr - The ClassLoaderResolver
      • getDdlWriter

        public Writer getDdlWriter()
        Accessor for the writer for DDL (if set).
        Returns:
        DDL writer
      • getCompleteDDL

        public boolean getCompleteDDL()
        Accessor for whether we should generate complete DDL when in that mode. Otherwise will generate "upgrade DDL".
        Returns:
        Generate complete DDL ?
      • hasWrittenDdlStatement

        public boolean hasWrittenDdlStatement​(String stmt)
        When we are in SchemaTool DDL mode, return if the supplied statement is already present. This is used to eliminate duplicate statements from a bidirectional relation.
        Parameters:
        stmt - The statement
        Returns:
        Whether we have that statement already
      • addWrittenDdlStatement

        public void addWrittenDdlStatement​(String stmt)
        When we are in SchemaTool DDL mode, add a new DDL statement.
        Parameters:
        stmt - The statement
      • validateTable

        public void validateTable​(TableImpl table,
                                  org.datanucleus.ClassLoaderResolver clr)
        Utility to validate the specified table. This is useful where we have made an update to the columns in a table and want to apply the updates to the datastore.
        Parameters:
        table - The table to validate
        clr - The ClassLoaderResolver
      • getClassNameForObjectID

        public String getClassNameForObjectID​(Object id,
                                              org.datanucleus.ClassLoaderResolver clr,
                                              org.datanucleus.ExecutionContext ec)
        Returns the class corresponding to the given object identity. If the identity is a SCOID, return the SCO class. If the identity is a DatastoreId then returns the associated persistable class name. If the identity is a SingleFieldIdentity then returns the associated persistable class name. If the object is an AppID PK, returns the associated PC class (as far as determinable). If the object id is an application id and the user supplies the "ec" argument then a check can be performed in the datastore where necessary.
        Specified by:
        getClassNameForObjectID in interface org.datanucleus.store.StoreManager
        Overrides:
        getClassNameForObjectID in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        id - The identity of some object.
        clr - ClassLoader resolver
        ec - execution context (optional - to allow check inheritance level in datastore)
        Returns:
        For datastore identity, return the class of the corresponding object. For application identity, return the class of the corresponding object. Otherwise returns null if unable to tie as the identity of a particular class.
      • getResultValueAtPosition

        public Object getResultValueAtPosition​(ResultSet rs,
                                               JavaTypeMapping mapping,
                                               int position)
        Method to return the value from the results for the mapping at the specified position.
        Parameters:
        rs - The results
        mapping - The mapping
        position - The position in the results
        Returns:
        The value at that position
        Throws:
        org.datanucleus.exceptions.NucleusDataStoreException - if an error occurs accessing the results
      • getNextValueForValueGenerator

        protected Object getNextValueForValueGenerator​(org.datanucleus.store.valuegenerator.ValueGenerator generator,
                                                       org.datanucleus.ExecutionContext ec)
        Accessor for the next value from the specified ValueGenerator. This implementation caters for datastore-specific generators and provides synchronisation on the connection to the datastore.
        Overrides:
        getNextValueForValueGenerator in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        generator - The generator
        ec - execution context
        Returns:
        The next value.
      • getPropertiesForValueGenerator

        protected Properties getPropertiesForValueGenerator​(org.datanucleus.metadata.AbstractClassMetaData cmd,
                                                            int absoluteFieldNumber,
                                                            org.datanucleus.ClassLoaderResolver clr,
                                                            org.datanucleus.metadata.SequenceMetaData seqmd,
                                                            org.datanucleus.metadata.TableGeneratorMetaData tablegenmd)
        Method to return the properties to pass to the ValueGenerator for the specified field.
        Overrides:
        getPropertiesForValueGenerator in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        cmd - MetaData for the class
        absoluteFieldNumber - Number of the field (-1 = datastore identity)
        clr - ClassLoader resolver
        seqmd - Any sequence metadata
        tablegenmd - Any table generator metadata
        Returns:
        The properties to use for this field
      • supportsValueGenerationStrategy

        public boolean supportsValueGenerationStrategy​(String strategy)
        Accessor for whether this value strategy is supported. Overrides the setting in the superclass for identity/sequence if the adapter doesn't support them.
        Specified by:
        supportsValueGenerationStrategy in interface org.datanucleus.store.StoreManager
        Overrides:
        supportsValueGenerationStrategy in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        strategy - The strategy
        Returns:
        Whether it is supported.
      • getValueGenerationStrategyForNative

        public String getValueGenerationStrategyForNative​(org.datanucleus.metadata.AbstractClassMetaData cmd,
                                                          int absFieldNumber)
        Method defining which value-strategy to use when the user specifies "native".
        Specified by:
        getValueGenerationStrategyForNative in interface org.datanucleus.store.StoreManager
        Overrides:
        getValueGenerationStrategyForNative in class org.datanucleus.store.AbstractStoreManager
        Returns:
        Should be overridden by all store managers that have other behaviour.
      • getSQLTypeInfoForJDBCType

        public SQLTypeInfo getSQLTypeInfoForJDBCType​(int jdbcType,
                                                     String sqlType)
                                              throws UnsupportedDataTypeException
        Accessor for the SQL type info for the specified JDBC type.
        Parameters:
        jdbcType - JDBC type
        sqlType - The SQL type name (if known, otherwise uses the default for this JDBC type).
        Returns:
        SQL type info
        Throws:
        UnsupportedDataTypeException - If the JDBC type is not found
      • getColumnInfoForColumnName

        public RDBMSColumnInfo getColumnInfoForColumnName​(Table table,
                                                          Connection conn,
                                                          DatastoreIdentifier column)
                                                   throws SQLException
        Returns the column info for a column name. This should be used instead of making direct calls to DatabaseMetaData.getColumns().

        Where possible, this method loads and caches column info for more than just the table being requested, improving performance by reducing the overall number of calls made to DatabaseMetaData.getColumns() (each of which usually results in one or more database queries).

        Parameters:
        table - The table/view
        conn - JDBC connection to the database.
        column - the column
        Returns:
        The ColumnInfo objects describing the column.
        Throws:
        SQLException - Thrown if an error occurs
      • getColumnInfoForTable

        public List<org.datanucleus.store.schema.StoreSchemaData> getColumnInfoForTable​(Table table,
                                                                                        Connection conn)
                                                                                 throws SQLException
        Returns the column info for a database table. This should be used instead of making direct calls to DatabaseMetaData.getColumns().

        Where possible, this method loads and caches column info for more than just the table being requested, improving performance by reducing the overall number of calls made to DatabaseMetaData.getColumns() (each of which usually results in one or more database queries).

        Parameters:
        table - The table/view
        conn - JDBC connection to the database.
        Returns:
        A list of ColumnInfo objects describing the columns of the table. The list is in the same order as was supplied by getColumns(). If no column info is found for the given table, an empty list is returned.
        Throws:
        SQLException - Thrown if an error occurs
      • invalidateColumnInfoForTable

        public void invalidateColumnInfoForTable​(Table table)
        Method to invalidate the cached column info for a table. This is called when we have just added columns to the table in the schema has the effect of a reload of the tables information the next time it is needed.
        Parameters:
        table - The table
      • getManagedTables

        public Collection<Table> getManagedTables​(String catalog,
                                                  String schema)
        Convenience accessor of the Table objects managed in this datastore at this point.
        Parameters:
        catalog - Name of the catalog to restrict the collection by (or null to not restrict)
        schema - Name of the schema to restrict the collection by (or null to not restrict)
        Returns:
        Collection of tables
      • resolveIdentifierMacro

        public void resolveIdentifierMacro​(org.datanucleus.util.MacroString.IdentifierMacro im,
                                           org.datanucleus.ClassLoaderResolver clr)
        Resolves an identifier macro. The public fields className, fieldName , and subfieldName of the given macro are taken as inputs, and the public value field is set to the SQL identifier of the corresponding database table or column.
        Parameters:
        im - The macro to resolve.
        clr - The ClassLoaderResolver
      • printInformation

        public void printInformation​(String category,
                                     PrintStream ps)
                              throws Exception
        Method to output particular information owned by this datastore. Supports "DATASTORE" and "SCHEMA" categories.
        Specified by:
        printInformation in interface org.datanucleus.store.StoreManager
        Overrides:
        printInformation in class org.datanucleus.store.AbstractStoreManager
        Parameters:
        category - Category of information
        ps - PrintStream
        Throws:
        Exception - Thrown if an error occurs in the output process
      • newJoinTable

        public Table newJoinTable​(Table ownerTable,
                                  org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                  org.datanucleus.ClassLoaderResolver clr)
        Called by (container) Mapping objects to request the creation of a join table. If the specified field doesn't require a join table then this returns null. If the join table already exists, then this returns it.
        Parameters:
        ownerTable - The table that owns this member.
        mmd - The metadata describing the field/property.
        clr - The ClassLoaderResolver
        Returns:
        The table (SetTable/ListTable/MapTable/ArrayTable)
      • registerTableInitialized

        public void registerTableInitialized​(Table table)
      • getSupportedOptions

        public Collection getSupportedOptions()
        Accessor for the supported options in string form
        Specified by:
        getSupportedOptions in interface org.datanucleus.store.StoreManager
        Overrides:
        getSupportedOptions in class org.datanucleus.store.AbstractStoreManager
      • insertValuesOnInsert

        public boolean insertValuesOnInsert​(ColumnMapping columnMapping)
        Accessor for whether this mapping requires values inserting on an INSERT.
        Parameters:
        columnMapping - The datastore mapping
        Returns:
        Whether values are to be inserted into this mapping on an INSERT
      • allowsBatching

        public boolean allowsBatching()
        Convenience method to return if the datastore supports batching and the user wants batching.
        Returns:
        If batching of statements is permissible
      • usesBackedSCOWrappers

        public boolean usesBackedSCOWrappers()
        Specified by:
        usesBackedSCOWrappers in interface org.datanucleus.store.StoreManager
      • useBackedSCOWrapperForMember

        public boolean useBackedSCOWrapperForMember​(org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                                    org.datanucleus.ExecutionContext ec)
        Specified by:
        useBackedSCOWrapperForMember in interface org.datanucleus.store.StoreManager
        Overrides:
        useBackedSCOWrapperForMember in class org.datanucleus.store.AbstractStoreManager
      • getCalendarForDateTimezone

        public Calendar getCalendarForDateTimezone()
        Accessor for the Calendar to be used in handling all timezone issues with the datastore. Utilises the "serverTimeZoneID" in providing this Calendar used in time/date conversions.
        Returns:
        The calendar to use for dateTimezone issues.
      • createDatabase

        public void createDatabase​(String catalogName,
                                   String schemaName,
                                   Properties props)
        Specified by:
        createDatabase in interface org.datanucleus.store.schema.SchemaAwareStoreManager
      • deleteDatabase

        public void deleteDatabase​(String catalogName,
                                   String schemaName,
                                   Properties props)
        Specified by:
        deleteDatabase in interface org.datanucleus.store.schema.SchemaAwareStoreManager
      • createSchemaForClasses

        public void createSchemaForClasses​(Set<String> inputClassNames,
                                           Properties props)
        Specified by:
        createSchemaForClasses in interface org.datanucleus.store.schema.SchemaAwareStoreManager
      • createSchemaSequences

        protected void createSchemaSequences​(Set<String> classNames,
                                             org.datanucleus.ClassLoaderResolver clr,
                                             FileWriter ddlWriter)
      • addSequenceTableForMetaData

        protected void addSequenceTableForMetaData​(org.datanucleus.metadata.MetaData md,
                                                   org.datanucleus.ClassLoaderResolver clr,
                                                   Set<String> seqTablesGenerated)
      • addSequenceForMetaData

        protected void addSequenceForMetaData​(org.datanucleus.metadata.MetaData md,
                                              String seq,
                                              org.datanucleus.ClassLoaderResolver clr,
                                              Set<String> sequencesGenerated,
                                              FileWriter ddlWriter)
      • deleteSchemaForClasses

        public void deleteSchemaForClasses​(Set<String> inputClassNames,
                                           Properties props)
        Specified by:
        deleteSchemaForClasses in interface org.datanucleus.store.schema.SchemaAwareStoreManager
      • validateSchemaForClasses

        public void validateSchemaForClasses​(Set<String> inputClassNames,
                                             Properties props)
        Specified by:
        validateSchemaForClasses in interface org.datanucleus.store.schema.SchemaAwareStoreManager
      • executeScript

        public void executeScript​(String script)
        Specified by:
        executeScript in interface org.datanucleus.store.schema.SchemaScriptAwareStoreManager
      • cleanInputClassNames

        protected static Set<String> cleanInputClassNames​(org.datanucleus.NucleusContext ctx,
                                                          Set<String> inputClassNames)
        Method to generate a set of class names using the input list. If no input class names are provided then uses the list of classes known to have metadata.
        Parameters:
        ctx - NucleusContext
        inputClassNames - Class names to start from
        Returns:
        The set of class names