org.springframework.orm.ojb
Interface PersistenceBrokerOperations

All Known Implementing Classes:
PersistenceBrokerTemplate

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 PersistenceBroker javadocs for details on those methods.

Since:
02.07.2004
Author:
Juergen Hoeller
See Also:
PersistenceBrokerTemplate, PersistenceBroker

Method Summary
 void clearCache()
           
 void delete(java.lang.Object entity)
           
 void deleteByQuery(org.apache.ojb.broker.query.Query query)
           
 java.lang.Object execute(PersistenceBrokerCallback action)
          Execute the action specified by the given action object within a PersistenceBroker.
 java.util.Collection executeFind(PersistenceBrokerCallback action)
          Execute the specified action assuming that the result object is a Collection.
 java.util.Collection getCollectionByQuery(org.apache.ojb.broker.query.Query query)
           
 int getCount(org.apache.ojb.broker.query.Query query)
           
 java.util.Iterator getIteratorByQuery(org.apache.ojb.broker.query.Query query)
           
 java.lang.Object getObjectByQuery(org.apache.ojb.broker.query.Query query)
           
 java.util.Iterator getReportQueryIteratorByQuery(org.apache.ojb.broker.query.Query query)
           
 void removeFromCache(java.lang.Object entityOrId)
           
 void store(java.lang.Object entity)
           
 

Method Detail

execute

public java.lang.Object execute(PersistenceBrokerCallback action)
                         throws DataAccessException
Execute the action specified by the given action object within a PersistenceBroker. Application exceptions thrown by the action object get propagated to the caller (can only be unchecked). OJB exceptions are transformed into appropriate DAO ones. Allows for returning a result object, i.e. a domain object or a collection of domain objects.

Note: Callback code is not supposed to handle transactions itself! Use an appropriate transaction manager like PersistenceBrokerTransactionManager.

Parameters:
action - action object that specifies the OJB action
Returns:
a result object returned by the action, or null
Throws:
DataAccessException - in case of OJB errors
See Also:
PersistenceBrokerTransactionManager, org.springframework.dao, org.springframework.transaction

executeFind

public java.util.Collection executeFind(PersistenceBrokerCallback action)
                                 throws DataAccessException
Execute the specified action assuming that the result object is a Collection. This is a convenience method for executing OJB queries within an action.

Parameters:
action - action object that specifies the OJB action
Returns:
a result object returned by the action, or null
Throws:
DataAccessException - in case of OJB errors

getObjectByQuery

public java.lang.Object getObjectByQuery(org.apache.ojb.broker.query.Query query)
                                  throws DataAccessException
Throws:
DataAccessException

getCollectionByQuery

public java.util.Collection getCollectionByQuery(org.apache.ojb.broker.query.Query query)
                                          throws DataAccessException
Throws:
DataAccessException

getIteratorByQuery

public java.util.Iterator getIteratorByQuery(org.apache.ojb.broker.query.Query query)
                                      throws DataAccessException
Throws:
DataAccessException

getReportQueryIteratorByQuery

public java.util.Iterator getReportQueryIteratorByQuery(org.apache.ojb.broker.query.Query query)

getCount

public int getCount(org.apache.ojb.broker.query.Query query)
             throws DataAccessException
Throws:
DataAccessException

removeFromCache

public void removeFromCache(java.lang.Object entityOrId)
                     throws DataAccessException
Throws:
DataAccessException

clearCache

public void clearCache()
                throws DataAccessException
Throws:
DataAccessException

store

public void store(java.lang.Object entity)
           throws DataAccessException
Throws:
DataAccessException

delete

public void delete(java.lang.Object entity)
            throws DataAccessException
Throws:
DataAccessException

deleteByQuery

public void deleteByQuery(org.apache.ojb.broker.query.Query query)
                   throws DataAccessException
Throws:
DataAccessException


Copyright (C) 2003-2004 The Spring Framework Project.