Class SQLStoreManager
- java.lang.Object
-
- com.sun.jdo.spi.persistence.support.sqlstore.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 Summary
Constructors Constructor Description SQLStoreManager(DatabaseMetaData databaseMetaData, String identifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(PersistenceManager pm, Collection actions)Executes the list of SQL requests contained inactions.voidexecuteBatch(PersistenceManager pm, UpdateObjectDesc request, boolean forceFlush)Retrieves the update query plan for the specified request and calls executeUpdateBatch for all statements in this plan.ClassgetClassByOidClass(Class oidType)ConfigCachegetConfigCache()Returns ConfigCache associated with this store.PersistenceConfiggetPersistenceConfig(Class classType)Returns the sqlstore model for classclassType.RetrieveDescgetRetrieveDesc(Class classType)Returns a new retrieve descriptor for anexternal (user) query.RetrieveDescgetRetrieveDesc(String fieldName, Class classType)Returns a new retrieve descriptor for anexternal (user) query.StateManagergetStateManager(Class classType)UpdateObjectDescgetUpdateObjectDesc(Class classType)DBVendorTypegetVendorType()Objectretrieve(PersistenceManager pm, RetrieveDesc action, ValueFetcher parameters)The retrieve method builds and executes the SQL query described by the action parameter.
-
-
-
Constructor Detail
-
SQLStoreManager
public SQLStoreManager(DatabaseMetaData databaseMetaData, String identifier)
- Parameters:
databaseMetaData- Instance of DatabaseMetaDataidentifier- 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 classclassType. 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:
getPersistenceConfigin interfacePersistenceStore
-
getConfigCache
public ConfigCache getConfigCache()
Description copied from interface:PersistenceStoreReturns ConfigCache associated with this store.- Specified by:
getConfigCachein interfacePersistenceStore- Returns:
- ConfigCache associated with this store.
-
execute
public void execute(PersistenceManager pm, Collection actions)
Executes the list of SQL requests contained inactions. Requests can be INSERT, UPDATE or DELETE operations.- Specified by:
executein interfacePersistenceStore- Throws:
JDODataStoreException- Will be thrown in case of errors or if the affected rows are less than the minimum rows required.
-
getClassByOidClass
public Class getClassByOidClass(Class oidType)
- Specified by:
getClassByOidClassin interfacePersistenceStore
-
getStateManager
public StateManager getStateManager(Class classType)
- Specified by:
getStateManagerin interfacePersistenceStore
-
getRetrieveDesc
public RetrieveDesc getRetrieveDesc(Class classType)
Returns a new retrieve descriptor for anexternal (user) query.- Specified by:
getRetrieveDescin interfacePersistenceStore- 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 fieldname.- Specified by:
getRetrieveDescin interfacePersistenceStore- Parameters:
fieldName- Name of the foreign field to be queried.classType- Persistence capable class includingfieldName.- Returns:
- A new retrieve descriptor for anexternal (user) query.
-
getUpdateObjectDesc
public UpdateObjectDesc getUpdateObjectDesc(Class classType)
- Specified by:
getUpdateObjectDescin interfacePersistenceStore
-
getVendorType
public DBVendorType getVendorType()
-
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:
retrievein interfacePersistenceStore- 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:
executeBatchin interfacePersistenceStore- Parameters:
pm- the persistence managerrequest- the request corresponding with the current state managerforceFlush- all in the update query plan must be executed
-
-