|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.ojb.broker.accesslayer.JdbcAccessImpl
public class JdbcAccessImpl
JdbcAccess is responsible for establishing performing SQL Queries against remote Databases. It hides all knowledge about JDBC from the BrokerImpl
Field Summary | |
---|---|
protected PersistenceBroker |
broker
The broker in use. |
protected Logger |
logger
The logger used. |
Constructor Summary | |
---|---|
JdbcAccessImpl(PersistenceBroker broker)
constructor is private, use getInstance to get the singleton instance of this class |
Method Summary | |
---|---|
private ValueContainer[] |
addValues(ValueContainer[] target,
ValueContainer[] source)
Helper method, returns the addition of both arrays (add source to target array) |
protected void |
assignAutoincrementIdentityColumns(ClassDescriptor cld,
Object target)
|
protected void |
assignAutoincrementSequences(ClassDescriptor cld,
Object target)
|
void |
executeDelete(ClassDescriptor cld,
Object obj)
performs a DELETE operation against RDBMS. |
void |
executeDelete(Query query,
ClassDescriptor cld)
Performs a DELETE operation based on the given Query against RDBMS. |
void |
executeInsert(ClassDescriptor cld,
Object obj)
performs an INSERT operation against RDBMS. |
ResultSetAndStatement |
executeQuery(Query query,
ClassDescriptor cld)
performs a SELECT operation against RDBMS. |
ResultSetAndStatement |
executeSQL(String sqlStatement,
ClassDescriptor cld,
boolean scrollable)
performs a SQL SELECT statement against RDBMS. |
ResultSetAndStatement |
executeSQL(String sql,
ClassDescriptor cld,
ValueContainer[] values,
boolean scrollable)
performs a SQL SELECT statement against RDBMS. |
void |
executeUpdate(ClassDescriptor cld,
Object obj)
performs an UPDATE operation against RDBMS. |
int |
executeUpdateSQL(String sqlStatement,
ClassDescriptor cld)
performs a SQL UPDTE, INSERT or DELETE statement against RDBMS. |
int |
executeUpdateSQL(String sqlStatement,
ClassDescriptor cld,
ValueContainer[] values1,
ValueContainer[] values2)
performs a SQL UPDTE, INSERT or DELETE statement against RDBMS. |
private Platform |
getPlatform()
Helper Platform accessor method |
private void |
harvestReturnValue(Object obj,
CallableStatement callable,
FieldDescriptor fmd,
int index)
Harvest a single value that was returned by a callable statement. |
private void |
harvestReturnValues(ProcedureDescriptor proc,
Object obj,
PreparedStatement stmt)
Harvest any values that may have been returned during the execution of a procedure. |
protected boolean |
isStoredProcedure(String sql)
Check if the specified sql-string is a stored procedure or not. |
Object |
materializeObject(ClassDescriptor cld,
Identity oid)
performs a primary key lookup operation against RDBMS and materializes an object from the resulting row. |
private void |
setLockingValues(ClassDescriptor cld,
Object obj,
ValueContainer[] oldLockingValues)
Set the locking values |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Logger logger
protected PersistenceBroker broker
Constructor Detail |
---|
public JdbcAccessImpl(PersistenceBroker broker)
Method Detail |
---|
private Platform getPlatform()
public void executeDelete(ClassDescriptor cld, Object obj) throws PersistenceBrokerException
executeDelete
in interface JdbcAccess
cld
- ClassDescriptor providing mapping information.obj
- The object to be deleted.
PersistenceBrokerException
public void executeDelete(Query query, ClassDescriptor cld) throws PersistenceBrokerException
Query
against RDBMS.
executeDelete
in interface JdbcAccess
query
- the query string.cld
- ClassDescriptor providing JDBC information.
PersistenceBrokerException
public void executeInsert(ClassDescriptor cld, Object obj) throws PersistenceBrokerException
executeInsert
in interface JdbcAccess
obj
- The Object to be inserted as a row of the underlying table.cld
- ClassDescriptor providing mapping information.
PersistenceBrokerException
public ResultSetAndStatement executeQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException
executeQuery
in interface JdbcAccess
query
- the query string.cld
- ClassDescriptor providing JDBC information.
PersistenceBrokerException
public ResultSetAndStatement executeSQL(String sqlStatement, ClassDescriptor cld, boolean scrollable) throws PersistenceBrokerException
JdbcAccess
executeSQL
in interface JdbcAccess
sqlStatement
- the query string.cld
- ClassDescriptor providing meta-information.scrollable
- Does this resultset need cursor control for operations like last, first and size
PersistenceBrokerException
public ResultSetAndStatement executeSQL(String sql, ClassDescriptor cld, ValueContainer[] values, boolean scrollable) throws PersistenceBrokerException
executeSQL
in interface JdbcAccess
sql
- the query string.cld
- ClassDescriptor providing meta-information.values
- The set of values to bind to the statement (may be null)scrollable
- Does this resultset need cursor control for operations like last, first and size
PersistenceBrokerException
public int executeUpdateSQL(String sqlStatement, ClassDescriptor cld) throws PersistenceBrokerException
JdbcAccess
executeUpdateSQL
in interface JdbcAccess
sqlStatement
- the query string.cld
- ClassDescriptor providing meta-information.
PersistenceBrokerException
public int executeUpdateSQL(String sqlStatement, ClassDescriptor cld, ValueContainer[] values1, ValueContainer[] values2) throws PersistenceBrokerException
executeUpdateSQL
in interface JdbcAccess
sqlStatement
- the query string.cld
- ClassDescriptor providing meta-information.values1
- The first set of values to bind to the statement (may be null)values2
- The second set of values to bind to the statement (may be null)
PersistenceBrokerException
private ValueContainer[] addValues(ValueContainer[] target, ValueContainer[] source)
public void executeUpdate(ClassDescriptor cld, Object obj) throws PersistenceBrokerException
executeUpdate
in interface JdbcAccess
obj
- The Object to be updated in the underlying table.cld
- ClassDescriptor providing mapping information.
PersistenceBrokerException
public Object materializeObject(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException
materializeObject
in interface JdbcAccess
oid
- contains the primary key info.cld
- ClassDescriptor providing mapping information.
PersistenceBrokerException
private void setLockingValues(ClassDescriptor cld, Object obj, ValueContainer[] oldLockingValues)
cld
- obj
- oldLockingValues
- private void harvestReturnValues(ProcedureDescriptor proc, Object obj, PreparedStatement stmt) throws PersistenceBrokerSQLException
proc
- the procedure descriptor that provides info about the procedure
that was invoked.obj
- the object that was persistedstmt
- the statement that was used to persist the object.
PersistenceBrokerSQLException
- if a problem occurs.private void harvestReturnValue(Object obj, CallableStatement callable, FieldDescriptor fmd, int index) throws PersistenceBrokerSQLException
obj
- the object that will receive the value that is harvested.callable
- the CallableStatement that contains the value to harvestfmd
- the FieldDescriptor that identifies the field where the
harvested value will be stord.index
- the parameter index.
PersistenceBrokerSQLException
- if a problem occurs.protected boolean isStoredProcedure(String sql)
sql
- The sql query to check
protected void assignAutoincrementSequences(ClassDescriptor cld, Object target) throws SequenceManagerException
SequenceManagerException
protected void assignAutoincrementIdentityColumns(ClassDescriptor cld, Object target) throws SequenceManagerException
SequenceManagerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |