|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openjpa.jdbc.kernel.JDBCStoreManager
public class JDBCStoreManager
StoreManager plugin that uses JDBC to store persistent data in a relational data store.
Nested Class Summary | |
---|---|
protected class |
JDBCStoreManager.RefCountConnection
Connection wrapper that keeps an internal ref count so that it knows when to really close. |
static class |
JDBCStoreManager.SelectKey
|
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 | |
---|---|
JDBCStoreManager()
|
Method Summary | |
---|---|
void |
addToSqlCache(Map cacheMap,
Object key,
Object value)
|
boolean |
assignField(OpenJPAStateManager sm,
int field,
boolean preFlush)
|
boolean |
assignObjectId(OpenJPAStateManager sm,
boolean preFlush)
|
void |
beforeStateChange(OpenJPAStateManager sm,
PCState fromState,
PCState toState)
|
void |
begin()
|
void |
beginOptimistic()
|
boolean |
cancelAll()
|
void |
close()
|
void |
commit()
|
int |
compareVersion(OpenJPAStateManager state,
Object v1,
Object v2)
|
protected JDBCStoreManager.RefCountConnection |
connectInternal()
Connect to the database. |
Object |
copyDataStoreId(Object oid,
ClassMetaData meta)
|
Map |
createSQLCache()
|
org.apache.openjpa.lib.rop.ResultObjectProvider |
executeExtent(ClassMetaData meta,
boolean subclasses,
FetchConfiguration fetch)
|
boolean |
exists(OpenJPAStateManager sm,
Object context)
|
Object |
find(Object oid,
ValueMapping vm,
JDBCFetchConfiguration fetch)
Find the object with the given oid. |
Collection |
flush(Collection sms)
|
Map |
getCacheMapFromQuerySQLCache(Object key)
|
Object |
getClientConnection()
|
JDBCConfiguration |
getConfiguration()
Return the configuration for this runtime. |
Connection |
getConnection()
Return a SQL connection to the database. |
StoreContext |
getContext()
Current persistence context. |
protected DataSource |
getDataSource()
|
Seq |
getDataStoreIdSequence(ClassMetaData meta)
|
Class |
getDataStoreIdType(ClassMetaData meta)
|
DBDictionary |
getDBDictionary()
Return the dictionary in use. |
JDBCFetchConfiguration |
getFetchConfiguration()
Return the current default fetch configuration. |
JDBCLockManager |
getLockManager()
If the lock manager in use is a JDBCLockManager , return it. |
Class |
getManagedType(Object oid)
|
Map |
getQuerySQLCache()
|
SQLFactory |
getSQLFactory()
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. |
Seq |
getValueSequence(FieldMetaData fmd)
|
protected void |
getVersion(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. |
boolean |
initialize(OpenJPAStateManager sm,
PCState state,
FetchConfiguration fetch,
Object context)
|
protected boolean |
initializeState(OpenJPAStateManager sm,
PCState state,
JDBCFetchConfiguration fetch,
ConnectionInfo info)
Initialize a newly-loaded instance. |
protected boolean |
isEmptyResult(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. |
boolean |
isQuerySQLCacheOn()
|
Object |
load(ClassMapping mapping,
JDBCFetchConfiguration fetch,
BitSet exclude,
Result result)
Load the object in the current row of the given result. |
boolean |
load(OpenJPAStateManager sm,
BitSet fields,
FetchConfiguration fetch,
int lockLevel,
Object context)
|
Collection |
loadAll(Collection sms,
PCState state,
int load,
FetchConfiguration fetch,
Object context)
|
void |
loadSubclasses(ClassMapping mapping)
Makes sure all subclasses of the given type are loaded in the JVM. |
Id |
newDataStoreId(long id,
ClassMapping mapping,
boolean subs)
Create a new datastore identity object from the given id value and mapping. |
Object |
newDataStoreId(Object val,
ClassMetaData meta)
|
FetchConfiguration |
newFetchConfiguration()
|
StoreQuery |
newQuery(String language)
|
protected Select |
newSelect(OpenJPAStateManager sm,
ClassMapping mapping,
JDBCFetchConfiguration fetch,
int subs)
|
void |
releaseConnection()
|
void |
retainConnection()
|
void |
rollback()
|
void |
rollbackOptimistic()
|
boolean |
select(Select sel,
ClassMapping mapping,
int subs,
OpenJPAStateManager sm,
BitSet fields,
JDBCFetchConfiguration fetch,
int eager,
boolean ident,
boolean outer)
For implementation use only. |
void |
setContext(StoreContext ctx)
|
void |
setContext(StoreContext ctx,
JDBCConfiguration conf)
|
protected void |
setMappedBy(OpenJPAStateManager sm,
FieldMapping mappedByFieldMapping,
Object mappedByObject)
|
boolean |
syncVersion(OpenJPAStateManager sm,
Object context)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCStoreManager()
Method Detail |
---|
public StoreContext getContext()
JDBCStore
getContext
in interface JDBCStore
public void setContext(StoreContext ctx)
setContext
in interface StoreManager
public void setContext(StoreContext ctx, JDBCConfiguration conf)
public JDBCConfiguration getConfiguration()
JDBCStore
getConfiguration
in interface JDBCStore
public DBDictionary getDBDictionary()
JDBCStore
getDBDictionary
in interface JDBCStore
public SQLFactory getSQLFactory()
JDBCStore
getSQLFactory
in interface JDBCStore
public JDBCLockManager getLockManager()
JDBCStore
JDBCLockManager
, return it.
getLockManager
in interface JDBCStore
public JDBCFetchConfiguration getFetchConfiguration()
JDBCStore
getFetchConfiguration
in interface JDBCStore
public void beginOptimistic()
beginOptimistic
in interface StoreManager
public void rollbackOptimistic()
rollbackOptimistic
in interface StoreManager
public void begin()
begin
in interface StoreManager
public void commit()
commit
in interface StoreManager
public void rollback()
rollback
in interface StoreManager
public void retainConnection()
retainConnection
in interface StoreManager
public void releaseConnection()
releaseConnection
in interface StoreManager
public Object getClientConnection()
getClientConnection
in interface StoreManager
public Connection getConnection()
JDBCStore
close
method 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.
getConnection
in interface JDBCStore
protected DataSource getDataSource()
public boolean exists(OpenJPAStateManager sm, Object context)
exists
in interface StoreManager
public boolean syncVersion(OpenJPAStateManager sm, Object context)
syncVersion
in interface StoreManager
public int compareVersion(OpenJPAStateManager state, Object v1, Object v2)
compareVersion
in interface StoreManager
public boolean initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch, Object context)
initialize
in interface StoreManager
protected boolean initializeState(OpenJPAStateManager sm, PCState state, JDBCFetchConfiguration fetch, ConnectionInfo info) throws ClassNotFoundException, SQLException
ClassNotFoundException
SQLException
protected void setMappedBy(OpenJPAStateManager sm, FieldMapping mappedByFieldMapping, Object mappedByObject)
protected void getVersion(ClassMapping mapping, OpenJPAStateManager sm, Result res) throws SQLException
SQLException
protected boolean isEmptyResult(Result res) throws SQLException
SQLException
protected Class getType(Result res, ClassMapping mapping)
protected Select newSelect(OpenJPAStateManager sm, ClassMapping mapping, JDBCFetchConfiguration fetch, int subs)
public boolean load(OpenJPAStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object context)
load
in interface StoreManager
public Collection loadAll(Collection sms, PCState state, int load, FetchConfiguration fetch, Object context)
loadAll
in interface StoreManager
public void beforeStateChange(OpenJPAStateManager sm, PCState fromState, PCState toState)
beforeStateChange
in interface StoreManager
public Collection flush(Collection sms)
flush
in interface StoreManager
public boolean cancelAll()
cancelAll
in interface StoreManager
public boolean assignObjectId(OpenJPAStateManager sm, boolean preFlush)
assignObjectId
in interface StoreManager
public boolean assignField(OpenJPAStateManager sm, int field, boolean preFlush)
assignField
in interface StoreManager
public Class getManagedType(Object oid)
getManagedType
in interface StoreManager
public Class getDataStoreIdType(ClassMetaData meta)
getDataStoreIdType
in interface StoreManager
public Object copyDataStoreId(Object oid, ClassMetaData meta)
copyDataStoreId
in interface StoreManager
public Object newDataStoreId(Object val, ClassMetaData meta)
newDataStoreId
in interface StoreManager
public Id newDataStoreId(long id, ClassMapping mapping, boolean subs)
JDBCStore
newDataStoreId
in interface JDBCStore
public org.apache.openjpa.lib.rop.ResultObjectProvider executeExtent(ClassMetaData meta, boolean subclasses, FetchConfiguration fetch)
executeExtent
in interface StoreManager
public StoreQuery newQuery(String language)
newQuery
in interface StoreManager
public FetchConfiguration newFetchConfiguration()
newFetchConfiguration
in interface StoreManager
public Seq getDataStoreIdSequence(ClassMetaData meta)
getDataStoreIdSequence
in interface StoreManager
public Seq getValueSequence(FieldMetaData fmd)
getValueSequence
in interface StoreManager
public void close()
close
in interface StoreManager
close
in interface org.apache.openjpa.lib.util.Closeable
protected JDBCStoreManager.RefCountConnection connectInternal() throws SQLException
SQLException
public Object find(Object oid, ValueMapping vm, JDBCFetchConfiguration fetch)
find
in interface JDBCStore
vm
- the mapping holding this oid, or null if not applicablepublic Object load(ClassMapping mapping, JDBCFetchConfiguration fetch, BitSet exclude, Result result) throws SQLException
SQLException
public boolean select(Select sel, ClassMapping mapping, int subs, OpenJPAStateManager sm, BitSet fields, JDBCFetchConfiguration fetch, int eager, boolean ident, boolean outer)
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
public void loadSubclasses(ClassMapping mapping)
loadSubclasses
in interface JDBCStore
public Map getCacheMapFromQuerySQLCache(Object key)
public void addToSqlCache(Map cacheMap, Object key, Object value)
public Map createSQLCache()
public boolean isQuerySQLCacheOn()
public Map getQuerySQLCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |