|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.orbroker.BrokerConnection
net.sourceforge.orbroker.QueryableConnection
net.sourceforge.orbroker.ExecutableConnection
net.sourceforge.orbroker.Executable
An Executable allows queries and execution of statements on an existing connection. It is up to the Connection supplier to manage all transactional properties, if any. This should generally only be used for container managed transactions and similar type external transaction management.
An Executable can also be passed to other methods that
needs to take part in a transaction, but without exposing the
commit and rollback capabilities of the
Transaction
object.
Broker.obtainExecutable(Connection)
,
Transaction.obtainExecutable()
Method Summary | |
void |
addStatement(String id,
String sql)
Add temporary statement. |
void |
addStatement(String id,
String sql,
String resultObjectId)
Add temporary statement. |
void |
closeIterator(Iterator iterator)
Close iterator. |
int |
execute(String statementID)
Execute statement. |
int |
executeBatch(String statementID,
String batchParameterName,
Collection batchParameters)
Execute a collection of parameters as a batch. |
int[] |
executeBatch(String statementID,
String batchParameterName,
Object[] batchParameters)
Execute an array of parameters as a batch. |
Object |
getParameter(String name)
Get parameter. |
Iterator |
iterate(String statementID,
int fetchSize)
Return a live iterator. |
void |
releaseSavepoint(Savepoint savepoint)
Release savepoint. |
void |
rollback(Savepoint savepoint)
Roll back to savepoint. |
List |
selectMany(String statementID)
Return a list of 0..n objects. |
int |
selectMany(String statementID,
Collection resultCollection)
Fill Collection with 0..n objects. |
int |
selectMany(String statementID,
Collection resultCollection,
int startRow,
int rowCount)
Fill Collection with 0..n objects. |
List |
selectMany(String statementID,
int startRow,
int rowCount)
Return a list of 0..n objects. |
Object |
selectOne(String statementID)
Return a single result object. |
boolean |
selectOne(String statementID,
Object resultObject)
Use supplied result object to apply values to. |
Object |
selectOneFromMany(String statementID,
int fromRow)
Return one result object from a query containing many. |
void |
setParameter(String name,
Object value)
Set named parameter. |
Savepoint |
setSavepoint()
Set savepoint. |
Savepoint |
setSavepoint(String name)
Set named savepoint. |
void |
setTextReplacement(String key,
String value)
Set a text replacement value. |
void |
setTextReplacements(Properties textReplacements)
Set text replacement values. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public int execute(String statementID) throws BrokerException, ConstraintException, DeadlockException
statementID
- Statement id
BrokerException
ConstraintException
DeadlockException
public int executeBatch(String statementID, String batchParameterName, Collection batchParameters) throws BrokerException, ConstraintException, DeadlockException
statementID
- Statement idbatchParameterName
- The parameter name that will be repeatedbatchParameters
- The collection of batch parameter objects
BrokerException
ConstraintException
DeadlockException
public int[] executeBatch(String statementID, String batchParameterName, Object[] batchParameters) throws BrokerException, ConstraintException, DeadlockException
statementID
- Statement idbatchParameterName
- The parameter name that will be repeatedbatchParameters
- The array of batch objects
BrokerException
ConstraintException
DeadlockException
public void releaseSavepoint(Savepoint savepoint)
savepoint
- SavepointConnection.releaseSavepoint(java.sql.Savepoint)
public void rollback(Savepoint savepoint)
savepoint
- SavepointConnection.rollback(java.sql.Savepoint)
public Savepoint setSavepoint()
Connection.setSavepoint()
public Savepoint setSavepoint(String name)
name
- Savepoint name
Connection.setSavepoint(String)
public final List selectMany(String statementID) throws BrokerException
List
will be returned if
result set is empty.
statementID
- Statement id
BrokerException
public final int selectMany(String statementID, Collection resultCollection) throws BrokerException
statementID
- Statement idresultCollection
- The collection where the result will be added.
BrokerException
public Iterator iterate(String statementID, int fetchSize)
Query
or Transaction
must be open.
statementID
- Statement idfetchSize
- Row buffer size
Iterator
of result objects.public final void closeIterator(Iterator iterator)
QueryableConnection.iterate(String, int)
. Only necessary if iterator has
not been exhausted by hasNext()
returning false
iterator
- The not fully iterated iterator.QueryableConnection.iterate(String, int)
public final int selectMany(String statementID, Collection resultCollection, int startRow, int rowCount) throws BrokerException
statementID
- Statement idresultCollection
- The collection where the result will be added.startRow
- The start row to return. First row is 1.rowCount
- The number of rows to return
BrokerException
public final List selectMany(String statementID, int startRow, int rowCount) throws BrokerException
List
will be returned if
result set is empty or if startRow
is greater than
the result set size.
statementID
- Statement idstartRow
- The start row to return. First row is 1.rowCount
- The number of rows to return
BrokerException
public final Object selectOne(String statementID) throws BrokerException, MoreThanOneRowException
statementID
- Statement id
null
if query returned 0
records.
BrokerException
MoreThanOneRowException
public final boolean selectOne(String statementID, Object resultObject) throws BrokerException, MoreThanOneRowException
statementID
- Statement idresultObject
- result object to map to
false
if query didn't return a record.
BrokerException
MoreThanOneRowException
public Object selectOneFromMany(String statementID, int fromRow) throws BrokerException
null
if query is empty or returnRow is out of range.
statementID
- Statement idfromRow
- Row to return. First row is 1.
BrokerException
public final void addStatement(String id, String sql) throws BrokerException, ConfigurationException
id
- The statement id.sql
- The SQL statement
BrokerException
ConfigurationException
public final void addStatement(String id, String sql, String resultObjectId) throws BrokerException, ConfigurationException
id
- The statement id.sql
- The SQL statementresultObjectId
- The result-object
id as
defined in the XML configuration file.
BrokerException
ConfigurationException
public final Object getParameter(String name)
BrokerConnection.setParameter(String, Object)
will be available with this method. Also if a stored procedure has
an output parameter that needs to be used as input in another
SQL statements, it's immediately available, i.e. there's no need
to code like this:
txn.setParameter("parm", txn.getParameter("parm"));
name
- parameter name
public final void setParameter(String name, Object value)
name
- parameter namevalue
- parameter valuepublic final void setTextReplacement(String key, String value)
{{key}}
string with the value.
This will override any value set on Broker.
key
- Text replacement keyvalue
- Text replacement valueBrokerConnection.setTextReplacements(Properties)
public final void setTextReplacements(Properties textReplacements)
{{key}}
type properties in an sql-statement with the values.
This will override any value set on Broker.
textReplacements
- The replacement values to set.BrokerConnection.setTextReplacement(String, String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |