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 void
execute(PersistenceManager pm, Collection actions)
Executes the list of SQL requests contained inactions
.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.Class
getClassByOidClass(Class oidType)
ConfigCache
getConfigCache()
Returns ConfigCache associated with this store.PersistenceConfig
getPersistenceConfig(Class classType)
Returns the sqlstore model for classclassType
.RetrieveDesc
getRetrieveDesc(Class classType)
Returns a new retrieve descriptor for anexternal (user) query.RetrieveDesc
getRetrieveDesc(String fieldName, Class classType)
Returns a new retrieve descriptor for anexternal (user) query.StateManager
getStateManager(Class classType)
UpdateObjectDesc
getUpdateObjectDesc(Class classType)
DBVendorType
getVendorType()
Object
retrieve(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:
getPersistenceConfig
in interfacePersistenceStore
-
getConfigCache
public ConfigCache getConfigCache()
Description copied from interface:PersistenceStore
Returns ConfigCache associated with this store.- Specified by:
getConfigCache
in 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:
execute
in 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:
getClassByOidClass
in interfacePersistenceStore
-
getStateManager
public StateManager getStateManager(Class classType)
- Specified by:
getStateManager
in interfacePersistenceStore
-
getRetrieveDesc
public RetrieveDesc getRetrieveDesc(Class classType)
Returns a new retrieve descriptor for anexternal (user) query.- Specified by:
getRetrieveDesc
in 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:
getRetrieveDesc
in 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:
getUpdateObjectDesc
in 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:
retrieve
in 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:
executeBatch
in interfacePersistenceStore
- Parameters:
pm
- the persistence managerrequest
- the request corresponding with the current state managerforceFlush
- all in the update query plan must be executed
-
-