|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PersistenceBrokerOperations
Interface that specifies a basic set of OJB PersistenceBroker operations. Implemented by PersistenceBrokerTemplate. Not often used, but a useful option to enhance testability, as it can easily be mocked or stubbed.
Provides PersistenceBrokerTemplate's data access methods that mirror
various PersistenceBroker methods. See the OJB PersistenceBroker javadocs
for details on those methods. Additionally, there is a convenient
getObjectById
method (Hibernate/JDO-style).
Note that operations that return an Iterator (that is,
getIteratorByQuery
and getReportQueryIteratorByQuery
)
are supposed to be used within Spring-managed transactions
(with PersistenceBrokerTransactionManager or JtaTransactionManager).
Else, the Iterator won't be able to read results from its ResultSet anymore,
as the underlying PersistenceBroker will already have been closed.
PersistenceBrokerTemplate
,
PersistenceBroker
,
getIteratorByQuery(org.apache.ojb.broker.query.Query)
,
getReportQueryIteratorByQuery(org.apache.ojb.broker.query.Query)
,
PersistenceBrokerTransactionManager
,
JtaTransactionManager
Method Summary | |
---|---|
void |
clearCache()
|
void |
delete(Object entity)
|
void |
deleteByQuery(org.apache.ojb.broker.query.Query query)
|
Object |
execute(PersistenceBrokerCallback action)
Execute the action specified by the given action object within a PersistenceBroker. |
Collection |
executeFind(PersistenceBrokerCallback action)
Execute the specified action assuming that the result object is a Collection. |
Collection |
getCollectionByQuery(org.apache.ojb.broker.query.Query query)
|
int |
getCount(org.apache.ojb.broker.query.Query query)
|
Iterator |
getIteratorByQuery(org.apache.ojb.broker.query.Query query)
|
Object |
getObjectById(Class entityClass,
Object idValue)
Return the persistent instance of the given entity class with the given id value, throwing an exception if not found. |
Object |
getObjectByQuery(org.apache.ojb.broker.query.Query query)
|
Iterator |
getReportQueryIteratorByQuery(org.apache.ojb.broker.query.Query query)
|
void |
removeFromCache(Object entityOrId)
|
void |
store(Object entity)
|
Method Detail |
---|
Object execute(PersistenceBrokerCallback action) throws DataAccessException
Note: Callback code is not supposed to handle transactions itself! Use an appropriate transaction manager like PersistenceBrokerTransactionManager.
action
- action object that specifies the OJB action
null
DataAccessException
- in case of OJB errorsPersistenceBrokerTransactionManager
,
org.springframework.dao
,
org.springframework.transaction
Collection executeFind(PersistenceBrokerCallback action) throws DataAccessException
action
- action object that specifies the OJB action
null
DataAccessException
- in case of OJB errorsObject getObjectById(Class entityClass, Object idValue) throws DataAccessException
The given id value is typically just unique within the namespace of the persistent class, corresponding to a single primary key in a database table.
entityClass
- a persistent classidValue
- an id value of the persistent instance
ObjectRetrievalFailureException
- if not found
DataAccessException
- in case of OJB errorsIdentityFactory.buildIdentity(Class, Object)
,
PersistenceBroker.getObjectByIdentity(org.apache.ojb.broker.Identity)
Object getObjectByQuery(org.apache.ojb.broker.query.Query query) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.getObjectByQuery(org.apache.ojb.broker.query.Query)
Collection getCollectionByQuery(org.apache.ojb.broker.query.Query query) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.getCollectionByQuery(org.apache.ojb.broker.query.Query)
Iterator getIteratorByQuery(org.apache.ojb.broker.query.Query query) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.getIteratorByQuery(org.apache.ojb.broker.query.Query)
Iterator getReportQueryIteratorByQuery(org.apache.ojb.broker.query.Query query) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.getReportQueryIteratorByQuery(org.apache.ojb.broker.query.Query)
int getCount(org.apache.ojb.broker.query.Query query) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.getCount(org.apache.ojb.broker.query.Query)
void removeFromCache(Object entityOrId) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.removeFromCache(java.lang.Object)
void clearCache() throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.clearCache()
void store(Object entity) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.store(java.lang.Object, org.apache.ojb.broker.util.ObjectModification)
void delete(Object entity) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.delete(java.lang.Object)
void deleteByQuery(org.apache.ojb.broker.query.Query query) throws DataAccessException
DataAccessException
- in case of OJB errorsPersistenceBroker.deleteByQuery(org.apache.ojb.broker.query.Query)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |