Package org.apache.openjpa.jdbc.kernel
Class JDBCStoreManager
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.JDBCStoreManager
-
- All Implemented Interfaces:
JDBCStore,StoreManager,Closeable
- Direct Known Subclasses:
SliceStoreManager
public class JDBCStoreManager extends Object implements StoreManager, JDBCStore
StoreManager plugin that uses JDBC to store persistent data in a relational data store.- Author:
- Abe White
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJDBCStoreManager.ClientConnectionConnection returned to client code.protected classJDBCStoreManager.RefCountConnectionConnection wrapper that keeps an internal ref count so that it knows when to really close.
-
Field Summary
-
Fields inherited from interface org.apache.openjpa.kernel.StoreManager
FORCE_LOAD_ALL, FORCE_LOAD_DFG, FORCE_LOAD_NONE, FORCE_LOAD_REFRESH, VERSION_DIFFERENT, VERSION_EARLIER, VERSION_LATER, VERSION_SAME
-
-
Constructor Summary
Constructors Constructor Description JDBCStoreManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanassignField(OpenJPAStateManager sm, int field, boolean preFlush)Assign a value to the given field.booleanassignObjectId(OpenJPAStateManager sm, boolean preFlush)Assign an object id to the given new instance.voidbeforeStateChange(OpenJPAStateManager sm, PCState fromState, PCState toState)Notification that the given state manager is about to change its lifecycle state.voidbegin()Begin a data store transaction.voidbeginOptimistic()Notification that an optimistic transaction has started.booleancancelAll()Cancel all pending data store statements.voidclose()Free any resources this store manager is using.voidcommit()Commit the current data store transaction.intcompareVersion(OpenJPAStateManager state, Object v1, Object v2)Compare the two version objects.protected JDBCStoreManager.RefCountConnectionconnectInternal()Connect to the database.ObjectcopyDataStoreId(Object oid, ClassMetaData meta)Copy the given object id value.ResultObjectProviderexecuteExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)Return a provider for all instances of the given candidate class, optionally including subclasses.booleanexists(OpenJPAStateManager sm, Object context)Verify that the given instance exists in the data store; return false if it does not.Objectfind(Object oid, ValueMapping vm, JDBCFetchConfiguration fetch)Find the object with the given oid.Collectionflush(Collection<OpenJPAStateManager> sms)Flush the given state manager collection to the datastore, returning a collection of exceptions encountered during flushing.ObjectgetClientConnection()Return a connection to the data store suitable for client use.JDBCConfigurationgetConfiguration()Return the configuration for this runtime.ConnectiongetConnection()Return a SQL connection to the database.StoreContextgetContext()Current persistence context.protected DataSourcegetDataSource()SeqgetDataStoreIdSequence(ClassMetaData meta)Return a sequence that generates datastore identity values for the given class.Class<?>getDataStoreIdType(ClassMetaData meta)Return the class used by this StoreManager for datastore identity values.DBDictionarygetDBDictionary()Return the dictionary in use.JDBCFetchConfigurationgetFetchConfiguration()Return the current default fetch configuration.JDBCLockManagergetLockManager()If the lock manager in use is aJDBCLockManager, return it.Class<?>getManagedType(Object oid)Return the persistent class for the given data store identity value.ConnectiongetNewConnection()Return a new SQL connection to the database.SQLFactorygetSQLFactory()Return the SQL factory for this runtime.protected Class<?>getType(Result res, ClassMapping mapping)This method is to provide override for non-JDBC or JDBC-like implementation of getting type from the result set.SeqgetValueSequence(FieldMetaData fmd)Return a sequence that generates values for the given field.protected voidgetVersion(ClassMapping mapping, OpenJPAStateManager sm, Result res)This method is to provide override for non-JDBC or JDBC-like implementation of getting version from the result set.booleaninitialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object context)Initialize the given state manager.protected booleaninitializeState(OpenJPAStateManager sm, PCState state, JDBCFetchConfiguration fetch, ConnectionInfo info)Initialize a newly-loaded instance.booleanisCached(List<Object> oids, BitSet edata)Verify that the given instance exists in the data store in memory; return false if it does not.protected booleanisEmptyResult(Result res)This method is to provide override for non-JDBC or JDBC-like implementation of checking whether the result set is empty or not.Objectload(ClassMapping mapping, JDBCFetchConfiguration fetch, BitSet exclude, Result result)Load the object in the current row of the given result.booleanload(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object context)Load the given state manager.CollectionloadAll(Collection sms, PCState state, int load, FetchConfiguration fetch, Object context)Initialize, load, or validate the existance of all of the given objects.voidloadSubclasses(ClassMapping mapping)Makes sure all subclasses of the given type are loaded in the JVM.IdnewDataStoreId(long id, ClassMapping mapping, boolean subs)Create a new datastore identity object from the given id value and mapping.ObjectnewDataStoreId(Object val, ClassMetaData meta)Create a new unique datastore identity for the given type from the given oid value (presumably pk, stringified oid, or oid instance).FetchConfigurationnewFetchConfiguration()Return a fetch configuration suitable for this runtime.StoreQuerynewQuery(String language)Return a query implementation suitable for this store.voidreleaseConnection()Instruct the store to release a retained connection.voidretainConnection()Instruct the store to retain a connection for continued use.voidrollback()Rollback the current data store transaction.voidrollbackOptimistic()Notification that an optimistic transaction was rolled back before a data store transaction ever began.booleanselect(Select sel, ClassMapping mapping, int subs, OpenJPAStateManager sm, BitSet fields, JDBCFetchConfiguration fetch, int eager, boolean ident, boolean outer)For implementation use only.voidsetContext(StoreContext ctx)Set a reference to the corresponding context.voidsetContext(StoreContext ctx, JDBCConfiguration conf)protected voidsetMappedBy(OpenJPAStateManager sm, FieldMapping mappedByFieldMapping, Object mappedByObject)booleansyncVersion(OpenJPAStateManager sm, Object context)Update the version information in the given state manager to the version stored in the data store.
-
-
-
Method Detail
-
getContext
public StoreContext getContext()
Description copied from interface:JDBCStoreCurrent persistence context.- Specified by:
getContextin interfaceJDBCStore
-
setContext
public void setContext(StoreContext ctx)
Description copied from interface:StoreManagerSet a reference to the corresponding context. This method will be called before the store manager is used. The store manager is responsible for pulling any necessary configuration data from the context, including the transaction mode and connection retain mode.- Specified by:
setContextin interfaceStoreManager
-
setContext
public void setContext(StoreContext ctx, JDBCConfiguration conf)
-
getConfiguration
public JDBCConfiguration getConfiguration()
Description copied from interface:JDBCStoreReturn the configuration for this runtime.- Specified by:
getConfigurationin interfaceJDBCStore
-
getDBDictionary
public DBDictionary getDBDictionary()
Description copied from interface:JDBCStoreReturn the dictionary in use.- Specified by:
getDBDictionaryin interfaceJDBCStore
-
getSQLFactory
public SQLFactory getSQLFactory()
Description copied from interface:JDBCStoreReturn the SQL factory for this runtime.- Specified by:
getSQLFactoryin interfaceJDBCStore
-
getLockManager
public JDBCLockManager getLockManager()
Description copied from interface:JDBCStoreIf the lock manager in use is aJDBCLockManager, return it.- Specified by:
getLockManagerin interfaceJDBCStore
-
getFetchConfiguration
public JDBCFetchConfiguration getFetchConfiguration()
Description copied from interface:JDBCStoreReturn the current default fetch configuration.- Specified by:
getFetchConfigurationin interfaceJDBCStore
-
beginOptimistic
public void beginOptimistic()
Description copied from interface:StoreManagerNotification that an optimistic transaction has started. This method does not replace theStoreManager.begin()method, which will still be called when a true data store transaction should begin.- Specified by:
beginOptimisticin interfaceStoreManager
-
rollbackOptimistic
public void rollbackOptimistic()
Description copied from interface:StoreManagerNotification that an optimistic transaction was rolled back before a data store transaction ever began.- Specified by:
rollbackOptimisticin interfaceStoreManager
-
begin
public void begin()
Description copied from interface:StoreManagerBegin a data store transaction. After this method is called, it is assumed that all further operations are operating in a single transaction that can be committed or rolled back. If optimistic transactions are in use, this method will only be called when the system requires a transactionally consistent connection due to a user request to flush or commit the transaction. In this case, it is possible that the optimistic transaction does not have the latest versions of all instances (i.e. another transaction has modified the same instances and committed since the optimistic transaction started). On commit, an exception must be thrown on any attempt to overwrite data for an instance with an older version.- Specified by:
beginin interfaceStoreManager
-
commit
public void commit()
Description copied from interface:StoreManagerCommit the current data store transaction.- Specified by:
commitin interfaceStoreManager
-
rollback
public void rollback()
Description copied from interface:StoreManagerRollback the current data store transaction.- Specified by:
rollbackin interfaceStoreManager
-
retainConnection
public void retainConnection()
Description copied from interface:StoreManagerInstruct the store to retain a connection for continued use. This will be invoked automatically based on the user's configured connection retain mode.- Specified by:
retainConnectionin interfaceStoreManager
-
releaseConnection
public void releaseConnection()
Description copied from interface:StoreManagerInstruct the store to release a retained connection. This will be invoked automatically based on the user's configured connection retain mode.- Specified by:
releaseConnectionin interfaceStoreManager
-
getClientConnection
public Object getClientConnection()
Description copied from interface:StoreManagerReturn a connection to the data store suitable for client use. If this method is called during a data store transaction, thie connection must be transactional. If no connection is in use, this method should create one to return.- Specified by:
getClientConnectionin interfaceStoreManager
-
getConnection
public Connection getConnection()
Description copied from interface:JDBCStoreReturn a SQL connection to the database. Theclosemethod should always be called on the connection to free any resources it is using. When appropriate, the close method is implemented as a no-op.- Specified by:
getConnectionin interfaceJDBCStore
-
getDataSource
protected DataSource getDataSource()
-
exists
public boolean exists(OpenJPAStateManager sm, Object context)
Description copied from interface:StoreManagerVerify that the given instance exists in the data store; return false if it does not.- Specified by:
existsin interfaceStoreManager
-
isCached
public boolean isCached(List<Object> oids, BitSet edata)
Description copied from interface:StoreManagerVerify that the given instance exists in the data store in memory; return false if it does not. When an object is found in memory the corresponding element of the BitSet is set to 1.- Specified by:
isCachedin interfaceStoreManager
-
syncVersion
public boolean syncVersion(OpenJPAStateManager sm, Object context)
Description copied from interface:StoreManagerUpdate the version information in the given state manager to the version stored in the data store.- Specified by:
syncVersionin interfaceStoreManager- Parameters:
sm- the instance to checkcontext- the current execution data, or null if not given to the calling method of the context- Returns:
- true if the instance still exists in the datastore and is up-to-date, false otherwise
-
compareVersion
public int compareVersion(OpenJPAStateManager state, Object v1, Object v2)
Description copied from interface:StoreManagerCompare the two version objects.- Specified by:
compareVersionin interfaceStoreManager- Parameters:
state- the state manager for the objectv1- the first version object to comparev2- the second version object to compare- Returns:
StoreManager.VERSION_LATERifv1is later thanv2StoreManager.VERSION_EARLIERifv1is earlier thanv2StoreManager.VERSION_SAMEifv1is the same asv2StoreManager.VERSION_DIFFERENTifv1is different fromv2, but the time difference of the versions cannot be determined
-
initialize
public boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object context)
Description copied from interface:StoreManagerInitialize the given state manager. The object id of the state manager will be set, and the state manager's metadata be set to the class of the instance to load, or possibly one of its superclasses. Initialization involves first calling theOpenJPAStateManager.initialize(java.lang.Class, org.apache.openjpa.kernel.PCState)method with a new instance of the correct type constructed with thePCRegistry.newInstance(Class, org.apache.openjpa.enhance.StateManager, boolean)method (this will reset the state manager's metadata if the actual type was a subclass). After instance initialization, load any the fields for the given fetch configuration that can be efficiently retrieved. If any of the configured fields are not loaded in this method, they will be loaded with a subsequent call toStoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object). If this method is called during a data store transaction, the instance's database record should be locked. Version information can be loaded if desired through theOpenJPAStateManager.setVersion(java.lang.Object)method.- Specified by:
initializein interfaceStoreManager- Parameters:
sm- the instance to initializestate- the lifecycle state to initialize the state manager withfetch- configuration for how to load the instancecontext- the current execution data, or null if not given to the calling method of the broker- Returns:
- true if the matching instance exists in the data store, false otherwise
-
initializeState
protected boolean initializeState(OpenJPAStateManager sm, PCState state, JDBCFetchConfiguration fetch, ConnectionInfo info) throws ClassNotFoundException, SQLException
Initialize a newly-loaded instance.- Throws:
ClassNotFoundExceptionSQLException
-
setMappedBy
protected void setMappedBy(OpenJPAStateManager sm, FieldMapping mappedByFieldMapping, Object mappedByObject)
-
getVersion
protected void getVersion(ClassMapping mapping, OpenJPAStateManager sm, Result res) throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of getting version from the result set.- Throws:
SQLException
-
isEmptyResult
protected boolean isEmptyResult(Result res) throws SQLException
This method is to provide override for non-JDBC or JDBC-like implementation of checking whether the result set is empty or not.- Throws:
SQLException
-
getType
protected Class<?> getType(Result res, ClassMapping mapping)
This method is to provide override for non-JDBC or JDBC-like implementation of getting type from the result set.
-
load
public boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object context)
Description copied from interface:StoreManagerLoad the given state manager. Note that any collection or map types loaded into the state manager will be proxied with the correct type; therefore the store manager does not have to load the same concrete collection/map types as the instance declares. However, array types must be consistent with the array type stored by the persistence capable instance. If this method is called during a data store transaction, the instance should be locked. If the given state manager does not have its version set already, version information can be loaded if desired through theOpenJPAStateManager.setVersion(java.lang.Object)method.- Specified by:
loadin interfaceStoreManager- Parameters:
sm- the instance to loadfields- set of fields to load; all field indexes in this set must be loaded; this set is mutablefetch- the fetch configuration to use when loading related objectslockLevel- attempt to load simple fields at this lock level; relations should be loaded at the read lock level of the fetch configurationcontext- the current execution data, or null if not given to the calling method of the broker- Returns:
- false if the object no longer exists in the database, true otherwise
-
loadAll
public Collection loadAll(Collection sms, PCState state, int load, FetchConfiguration fetch, Object context)
Description copied from interface:StoreManagerInitialize, load, or validate the existance of all of the given objects. This method is called from various broker methods that act on multiple objects, such asStoreContext.retrieveAll(java.util.Collection<java.lang.Object>, boolean, org.apache.openjpa.kernel.OpCallbacks). It gives the store manager an opportunity to efficiently batch-load data for several objects. Each of the given state managers will be in one of three states, each requiring a different action:stateManager.getO () == null: An uninitialized state manager. Perform the same actions as inStoreManager.initialize(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.kernel.PCState, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object).load != FORCE_LOAD_NONE || stateManager.getPCState () == PCState.HOLLOW: A hollow state manager, or one whose fields must be loaded because this is a refresh or retrieve action. Peform the same actions as inStoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object), choosing the fields to load based on the fetch configuration, or loading all fields ifload == FORCE_LOAD_ALL. Any required fields left unloaded will cause a subsequent invocation ofStoreManager.load(org.apache.openjpa.kernel.OpenJPAStateManager, java.util.BitSet, org.apache.openjpa.kernel.FetchConfiguration, int, java.lang.Object)on the individual object in question.load == FORCE_LOAD_NONE && stateManager.getPCState () != PCState.HOLLOW: A non-hollow state manager. Perform the same actions as inStoreManager.exists(org.apache.openjpa.kernel.OpenJPAStateManager, java.lang.Object), and load additional state if desired. Non-hollow objects will only be included outside of refresh invocations if a user callsfindAllwith thevalidateparameter set totrue.
- Specified by:
loadAllin interfaceStoreManager- Parameters:
sms- the state manager instances to loadstate- the lifecycle state to initialize uninitialized state managers with; may be null if no uninitialized instances are included insmsload- one of the FORCE_LOAD_* constants describing the fields to force-load if this is a refresh or retrieve actionfetch- the current fetch configuration to use when loading related objectscontext- the current execution data, or null if not given to the calling method of the broker- Returns:
- a collection of the state manager identities for which no data store record exists
- See Also:
ImplHelper.loadAll(java.util.Collection, org.apache.openjpa.kernel.StoreManager, org.apache.openjpa.kernel.PCState, int, org.apache.openjpa.kernel.FetchConfiguration, java.lang.Object)
-
beforeStateChange
public void beforeStateChange(OpenJPAStateManager sm, PCState fromState, PCState toState)
Description copied from interface:StoreManagerNotification that the given state manager is about to change its lifecycle state. The store manager is not required to do anything in this method, but some back ends may need to.- Specified by:
beforeStateChangein interfaceStoreManager
-
flush
public Collection flush(Collection<OpenJPAStateManager> sms)
Description copied from interface:StoreManagerFlush the given state manager collection to the datastore, returning a collection of exceptions encountered during flushing. The given collection may include states that do not require data store action, such as persistent-clean instances or persistent-dirty instances that have not been modified since they were last flushed. For datastore updates and inserts, the dirty, non-flushed fields of each state should be flushed. New instances without an assigned object id should be given one viaOpenJPAStateManager.setObjectId(java.lang.Object). New instances with value-strategy fields that have not been assigned yet should have their fields set. Datastore version information should be updated during flush, and the state manager's version indicator updated through theOpenJPAStateManager.setNextVersion(java.lang.Object)method. The current version will roll over to this next version upon successful commit.- Specified by:
flushin interfaceStoreManager- See Also:
org.apache.openjpa.util.ApplicationIds#assign()
-
cancelAll
public boolean cancelAll()
Description copied from interface:StoreManagerCancel all pending data store statements.- Specified by:
cancelAllin interfaceStoreManager- Returns:
- true if any statements cancelled, false otherwise
-
assignObjectId
public boolean assignObjectId(OpenJPAStateManager sm, boolean preFlush)
Description copied from interface:StoreManagerAssign an object id to the given new instance. Return false if the instance cannot be assigned an identity because a flush is required (for example, the identity is determined by the datastore on insert). For application identity instances, the assigned object id should be based on field state. The implementation is responsible for using the proper value strategy according to the instance metadata. This method is called the first time a user requests the oid of a new instance before flush.- Specified by:
assignObjectIdin interfaceStoreManagerpreFlush- whether this assignment is being requested by the system as part of pre-flush activities, and can be ignored if it is more efficient to assign withinStoreManager.flush(java.util.Collection<org.apache.openjpa.kernel.OpenJPAStateManager>)- See Also:
ImplHelper.generateFieldValue(org.apache.openjpa.kernel.StoreContext, org.apache.openjpa.meta.FieldMetaData),ImplHelper.generateIdentityValue(org.apache.openjpa.kernel.StoreContext, org.apache.openjpa.meta.ClassMetaData, int),org.apache.openjpa.util.ApplicationIds#assign()
-
assignField
public boolean assignField(OpenJPAStateManager sm, int field, boolean preFlush)
Description copied from interface:StoreManagerAssign a value to the given field. Return false if the value cannot be assigned because a flush is required (for example, the field value is determined by the datastore on insert). This method is called the first time a user requests the value of a field with a value-strategy on a new instance before flush.- Specified by:
assignFieldin interfaceStoreManagerpreFlush- whether this assignment is being requested by the system as part of pre-flush activities, and can be ignored if it is more efficient to assign withinStoreManager.flush(java.util.Collection<org.apache.openjpa.kernel.OpenJPAStateManager>)- See Also:
ImplHelper.generateFieldValue(org.apache.openjpa.kernel.StoreContext, org.apache.openjpa.meta.FieldMetaData)
-
getManagedType
public Class<?> getManagedType(Object oid)
Description copied from interface:StoreManagerReturn the persistent class for the given data store identity value. If the given value is not a datastore identity object, return null.- Specified by:
getManagedTypein interfaceStoreManager
-
getDataStoreIdType
public Class<?> getDataStoreIdType(ClassMetaData meta)
Description copied from interface:StoreManagerReturn the class used by this StoreManager for datastore identity values. The given metadata may be null, in which case the return value should the common datastore identity class for all classes, or null if this store manager does not use a common identity class.- Specified by:
getDataStoreIdTypein interfaceStoreManager
-
copyDataStoreId
public Object copyDataStoreId(Object oid, ClassMetaData meta)
Description copied from interface:StoreManagerCopy the given object id value. Use the described type of the given metadata, which may be a subclass of the given oid's described type.- Specified by:
copyDataStoreIdin interfaceStoreManager
-
newDataStoreId
public Object newDataStoreId(Object val, ClassMetaData meta)
Description copied from interface:StoreManagerCreate a new unique datastore identity for the given type from the given oid value (presumably pk, stringified oid, or oid instance).- Specified by:
newDataStoreIdin interfaceStoreManager
-
newDataStoreId
public Id newDataStoreId(long id, ClassMapping mapping, boolean subs)
Description copied from interface:JDBCStoreCreate a new datastore identity object from the given id value and mapping.- Specified by:
newDataStoreIdin interfaceJDBCStore
-
executeExtent
public ResultObjectProvider executeExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)
Description copied from interface:StoreManagerReturn a provider for all instances of the given candidate class, optionally including subclasses. The given candidate may be an unmapped type with mapped subclasses. If the provider is iterated within a data store transaction, returned instances should be locked.- Specified by:
executeExtentin interfaceStoreManager
-
newQuery
public StoreQuery newQuery(String language)
Description copied from interface:StoreManagerReturn a query implementation suitable for this store. If the query is iterated within a data store transaction, returned instances should be locked. Return null if this store does not support native execution of the given language. OpenJPA can execute JPQL in memory even without back end support.- Specified by:
newQueryin interfaceStoreManager- Parameters:
language- the query language
-
newFetchConfiguration
public FetchConfiguration newFetchConfiguration()
Description copied from interface:StoreManagerReturn a fetch configuration suitable for this runtime. Typically will be or extendFetchConfigurationImpl.- Specified by:
newFetchConfigurationin interfaceStoreManager
-
getDataStoreIdSequence
public Seq getDataStoreIdSequence(ClassMetaData meta)
Description copied from interface:StoreManagerReturn a sequence that generates datastore identity values for the given class. This method will only be called when the identity strategy for the class is one of: If the identity strategy cannot be represented as a sequence, return null.- Specified by:
getDataStoreIdSequencein interfaceStoreManager
-
getValueSequence
public Seq getValueSequence(FieldMetaData fmd)
Description copied from interface:StoreManagerReturn a sequence that generates values for the given field. This method will only be called when the value strategy for the field is one of: If the value strategy cannot be represented as a sequence, return null.- Specified by:
getValueSequencein interfaceStoreManager
-
close
public void close()
Description copied from interface:StoreManagerFree any resources this store manager is using.- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceStoreManager
-
connectInternal
protected JDBCStoreManager.RefCountConnection connectInternal() throws SQLException
Connect to the database. This method is separated out so that it can be overridden.- Throws:
SQLException
-
getNewConnection
public Connection getNewConnection()
Description copied from interface:JDBCStoreReturn a new SQL connection to the database. This is used when the current connection still has a open result set and a new database operation needs to be done. Theclosemethod should always be called on the connection to free any resources it is using. When appropriate, the close method is implemented as a no-op.- Specified by:
getNewConnectionin interfaceJDBCStore
-
find
public Object find(Object oid, ValueMapping vm, JDBCFetchConfiguration fetch)
Find the object with the given oid.
-
load
public Object load(ClassMapping mapping, JDBCFetchConfiguration fetch, BitSet exclude, Result result) throws SQLException
Load the object in the current row of the given result.- Throws:
SQLException
-
select
public boolean select(Select sel, ClassMapping mapping, int subs, OpenJPAStateManager sm, BitSet fields, JDBCFetchConfiguration fetch, int eager, boolean ident, boolean outer)
For implementation use only. Return a select for the proper mappings. Return null if no select is needed. The method is designed to be complementary to the load methods.- Parameters:
sel- select to build onmapping- the mapping for the base type to select forsubs- whether the select might include subclasses of the given mappingsm- state manager if an instance is being loaded or initialized, else nullfields- if a state manager is being loaded, the set of fields that must be loaded in order, else nullfetch- the fetch configuration; used if no specific fields must be loaded, and used when selecting relationseager- eager fetch mode to useident- whether to select primary key columns as distinct identifiersouter- whether we're outer-joining to this type- Returns:
- true if the select is required, false otherwise
-
loadSubclasses
public void loadSubclasses(ClassMapping mapping)
Makes sure all subclasses of the given type are loaded in the JVM. This is usually done automatically.- Specified by:
loadSubclassesin interfaceJDBCStore
-
-