|
||||||||||
| 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 | |
|---|---|
static class |
JDBCStoreManager.ClientConnection
Connection returned to client code. |
protected class |
JDBCStoreManager.RefCountConnection
Connection 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 | |
|---|---|
JDBCStoreManager()
|
|
| Method Summary | |
|---|---|
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)
|
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)
|
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)
|
Connection |
getNewConnection()
Return a new SQL connection to the database. |
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. |
boolean |
isCached(List<Object> oids,
BitSet edata)
|
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. |
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)
|
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 JDBCStorepublic void setContext(StoreContext ctx)
setContext in interface StoreManager
public void setContext(StoreContext ctx,
JDBCConfiguration conf)
public JDBCConfiguration getConfiguration()
JDBCStore
getConfiguration in interface JDBCStorepublic DBDictionary getDBDictionary()
JDBCStore
getDBDictionary in interface JDBCStorepublic SQLFactory getSQLFactory()
JDBCStore
getSQLFactory in interface JDBCStorepublic JDBCLockManager getLockManager()
JDBCStoreJDBCLockManager, return it.
getLockManager in interface JDBCStorepublic JDBCFetchConfiguration getFetchConfiguration()
JDBCStore
getFetchConfiguration in interface JDBCStorepublic void beginOptimistic()
beginOptimistic in interface StoreManagerpublic void rollbackOptimistic()
rollbackOptimistic in interface StoreManagerpublic void begin()
begin in interface StoreManagerpublic void commit()
commit in interface StoreManagerpublic void rollback()
rollback in interface StoreManagerpublic void retainConnection()
retainConnection in interface StoreManagerpublic void releaseConnection()
releaseConnection in interface StoreManagerpublic Object getClientConnection()
getClientConnection in interface StoreManagerpublic Connection getConnection()
JDBCStoreclose 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 JDBCStoreprotected DataSource getDataSource()
public boolean exists(OpenJPAStateManager sm,
Object context)
exists in interface StoreManager
public boolean isCached(List<Object> oids,
BitSet edata)
isCached 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)
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 StoreManagerpublic Collection flush(Collection sms)
flush in interface StoreManagerpublic 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 StoreManagerpublic Class<?> getManagedType(Object oid)
getManagedType in interface StoreManagerpublic 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 StoreManagerpublic StoreQuery newQuery(String language)
newQuery in interface StoreManagerpublic FetchConfiguration newFetchConfiguration()
newFetchConfiguration in interface StoreManagerpublic Seq getDataStoreIdSequence(ClassMetaData meta)
getDataStoreIdSequence in interface StoreManagerpublic Seq getValueSequence(FieldMetaData fmd)
getValueSequence in interface StoreManagerpublic void close()
close in interface StoreManagerclose in interface org.apache.openjpa.lib.util.Closeable
protected JDBCStoreManager.RefCountConnection connectInternal()
throws SQLException
SQLExceptionpublic Connection getNewConnection()
JDBCStoreclose 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.
getNewConnection in interface JDBCStore
public Object find(Object oid,
ValueMapping vm,
JDBCFetchConfiguration fetch)
find in interface JDBCStorevm - the mapping holding this oid, or null if not applicable
public 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||