Class SQLStoreManager

  • All Implemented Interfaces:
    PersistenceStore

    public class SQLStoreManager
    extends Object
    implements PersistenceStore

    This class connects to a persistent store. It supports relational databases such as Oracle and MS SQLServer. This class knows how to generate SQL statements to access and manipulate objects stored in a relational database.

    • Constructor Detail

      • SQLStoreManager

        public SQLStoreManager​(DatabaseMetaData databaseMetaData,
                               String identifier)
        Parameters:
        databaseMetaData - Instance of DatabaseMetaData
        identifier - identifier of the caller creating a new instance of SQLStoreManager. Typically this is identifier of PersistenceManagerFacory initializing this SQLStoreManager.
    • Method Detail

      • getPersistenceConfig

        public PersistenceConfig getPersistenceConfig​(Class classType)
        Returns the sqlstore model for class classType. Sqlstore model information is cached. If the model cache does not already hold a model instance for the particular class, a new instance is created, initialized and put into the cache. The access to the model cache is synchronized.
        Specified by:
        getPersistenceConfig in interface PersistenceStore
      • execute

        public void execute​(PersistenceManager pm,
                            Collection actions)
        Executes the list of SQL requests contained in actions. Requests can be INSERT, UPDATE or DELETE operations.
        Specified by:
        execute in interface PersistenceStore
        Throws:
        JDODataStoreException - Will be thrown in case of errors or if the affected rows are less than the minimum rows required.
      • getRetrieveDesc

        public RetrieveDesc getRetrieveDesc​(Class classType)
        Returns a new retrieve descriptor for anexternal (user) query.
        Specified by:
        getRetrieveDesc in interface PersistenceStore
        Parameters:
        classType - Type of the persistence capable class to be queried.
        Returns:
        A new retrieve descriptor for anexternal (user) query.
      • getRetrieveDesc

        public RetrieveDesc getRetrieveDesc​(String fieldName,
                                            Class classType)
        Returns a new retrieve descriptor for anexternal (user) query. This retrieve descriptor can be used to query for the foreign field name.
        Specified by:
        getRetrieveDesc in interface PersistenceStore
        Parameters:
        fieldName - Name of the foreign field to be queried.
        classType - Persistence capable class including fieldName.
        Returns:
        A new retrieve descriptor for anexternal (user) query.
      • retrieve

        public Object retrieve​(PersistenceManager pm,
                               RetrieveDesc action,
                               ValueFetcher parameters)
        The retrieve method builds and executes the SQL query described by the action parameter.
        Specified by:
        retrieve in interface PersistenceStore
        Parameters:
        action - The action parameter holds the RetrieveDesc describing what should be selected from the database.
        parameters - Query parameters.
      • executeBatch

        public void executeBatch​(PersistenceManager pm,
                                 UpdateObjectDesc request,
                                 boolean forceFlush)
        Retrieves the update query plan for the specified request and calls executeUpdateBatch for all statements in this plan.
        Specified by:
        executeBatch in interface PersistenceStore
        Parameters:
        pm - the persistence manager
        request - the request corresponding with the current state manager
        forceFlush - all in the update query plan must be executed