Spring Framework

org.springframework.orm.jdo
Interface JdoOperations

All Known Implementing Classes:
JdoTemplate

Deprecated. as of Spring 3.1, in favor of native PersistenceManager usage (see TransactionAwarePersistenceManagerFactoryProxy and SpringPersistenceManagerProxyBean)

@Deprecated
public interface JdoOperations

Interface that specifies a basic set of JDO operations, implemented by JdoTemplate. Not often used, but a useful option to enhance testability, as it can easily be mocked or stubbed.

Defines JdoTemplate's data access methods that mirror various JDO PersistenceManager methods. Users are strongly encouraged to read the JDO PersistenceManager javadocs for details on the semantics of those methods.

Note that lazy loading will just work with an open JDO PersistenceManager, either within a managed transaction or within OpenPersistenceManagerInViewFilter/ OpenPersistenceManagerInViewInterceptor. Furthermore, some operations just make sense within transactions, for example: evict, evictAll, flush.

Updated to build on JDO 2.0 or higher, as of Spring 2.5.

Since:
1.1
Author:
Juergen Hoeller
See Also:
JdoTemplate, PersistenceManager, JdoTransactionManager, JdoDialect, OpenPersistenceManagerInViewFilter, OpenPersistenceManagerInViewInterceptor

Method Summary
 void deletePersistent(java.lang.Object entity)
          Deprecated. Delete the given persistent instance.
 void deletePersistentAll(java.util.Collection entities)
          Deprecated. Delete all given persistent instances.
<T> T
detachCopy(T entity)
          Deprecated. Detach a copy of the given persistent instance from the current JDO transaction, for use outside a JDO transaction (for example, as web form object).
<T> java.util.Collection<T>
detachCopyAll(java.util.Collection<T> entities)
          Deprecated. Detach copies of the given persistent instances from the current JDO transaction, for use outside a JDO transaction (for example, as web form objects).
 void evict(java.lang.Object entity)
          Deprecated. Remove the given object from the PersistenceManager cache.
 void evictAll()
          Deprecated. Remove all objects from the PersistenceManager cache.
 void evictAll(java.util.Collection entities)
          Deprecated. Remove all given objects from the PersistenceManager cache.
<T> T
execute(JdoCallback<T> action)
          Deprecated. Execute the action specified by the given action object within a PersistenceManager.
 java.util.Collection executeFind(JdoCallback<?> action)
          Deprecated. Execute the specified action assuming that the result object is a Collection.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass)
          Deprecated. Find all persistent instances of the given class.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass, java.lang.String filter)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass, java.lang.String filter, java.lang.String ordering)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter, with the given result ordering.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass, java.lang.String filter, java.lang.String parameters, java.util.Map<java.lang.String,?> values)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass, java.lang.String filter, java.lang.String parameters, java.util.Map<java.lang.String,?> values, java.lang.String ordering)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values, with the given result ordering.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass, java.lang.String filter, java.lang.String parameters, java.lang.Object... values)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values.
<T> java.util.Collection<T>
find(java.lang.Class<T> entityClass, java.lang.String filter, java.lang.String parameters, java.lang.Object[] values, java.lang.String ordering)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values, with the given result ordering.
 java.util.Collection find(java.lang.String queryString)
          Deprecated. Find persistent instances through the given single-string JDOQL query.
 java.util.Collection find(java.lang.String queryString, java.util.Map<java.lang.String,?> values)
          Deprecated. Find persistent instances through the given single-string JDOQL query.
 java.util.Collection find(java.lang.String queryString, java.lang.Object... values)
          Deprecated. Find persistent instances through the given single-string JDOQL query.
 java.util.Collection find(java.lang.String language, java.lang.Object queryObject)
          Deprecated. Find persistent instances through the given query object in the specified query language.
<T> java.util.Collection<T>
findByNamedQuery(java.lang.Class<T> entityClass, java.lang.String queryName)
          Deprecated. Find persistent instances through the given named query.
<T> java.util.Collection<T>
findByNamedQuery(java.lang.Class<T> entityClass, java.lang.String queryName, java.util.Map<java.lang.String,?> values)
          Deprecated. Find persistent instances through the given named query.
<T> java.util.Collection<T>
findByNamedQuery(java.lang.Class<T> entityClass, java.lang.String queryName, java.lang.Object... values)
          Deprecated. Find persistent instances through the given named query.
 void flush()
          Deprecated. Flush all transactional modifications to the database.
<T> T
getObjectById(java.lang.Class<T> entityClass, java.lang.Object idValue)
          Deprecated. Return the persistent instance of the given entity class with the given id value, throwing an exception if not found.
 java.lang.Object getObjectById(java.lang.Object objectId)
          Deprecated. Return the persistent instance with the given JDO object id, throwing an exception if not found.
<T> T
makePersistent(T entity)
          Deprecated. Make the given transient instance persistent.
<T> java.util.Collection<T>
makePersistentAll(java.util.Collection<T> entities)
          Deprecated. Make the given transient instances persistent.
 void refresh(java.lang.Object entity)
          Deprecated. Re-read the state of the given persistent instance.
 void refreshAll()
          Deprecated. Re-read the state of all persistent instances.
 void refreshAll(java.util.Collection entities)
          Deprecated. Re-read the state of all given persistent instances.
 

Method Detail

execute

<T> T execute(JdoCallback<T> action)
          throws DataAccessException
Deprecated. 
Execute the action specified by the given action object within a PersistenceManager. Application exceptions thrown by the action object get propagated to the caller (can only be unchecked). JDO 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 JdoTransactionManager.

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

executeFind

java.util.Collection executeFind(JdoCallback<?> action)
                                 throws DataAccessException
Deprecated. 
Execute the specified action assuming that the result object is a Collection. This is a convenience method for executing JDO queries within an action.

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

getObjectById

java.lang.Object getObjectById(java.lang.Object objectId)
                               throws DataAccessException
Deprecated. 
Return the persistent instance with the given JDO object id, throwing an exception if not found.

A JDO object id identifies both the persistent class and the id within the namespace of that class.

Parameters:
objectId - a JDO object id of the persistent instance
Returns:
the persistent instance
Throws:
ObjectRetrievalFailureException - if not found
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.getObjectById(Object, boolean)

getObjectById

<T> T getObjectById(java.lang.Class<T> entityClass,
                    java.lang.Object idValue)
                throws DataAccessException
Deprecated. 
Return the persistent instance of the given entity class with the given id value, throwing an exception if not found.

The given id value is typically just unique within the namespace of the persistent class. Its toString value must correspond to the toString value of the corresponding JDO object id.

Usually, the passed-in value will have originated from the primary key field of a persistent object that uses JDO's application identity.

Parameters:
entityClass - a persistent class
idValue - an id value of the persistent instance
Returns:
the persistent instance
Throws:
ObjectRetrievalFailureException - if not found
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.getObjectById(Object, boolean), PersistenceManager.getObjectById(Class, Object)

evict

void evict(java.lang.Object entity)
           throws DataAccessException
Deprecated. 
Remove the given object from the PersistenceManager cache.

Parameters:
entity - the persistent instance to evict
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.evict(Object)

evictAll

void evictAll(java.util.Collection entities)
              throws DataAccessException
Deprecated. 
Remove all given objects from the PersistenceManager cache.

Parameters:
entities - the persistent instances to evict
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.evictAll(java.util.Collection)

evictAll

void evictAll()
              throws DataAccessException
Deprecated. 
Remove all objects from the PersistenceManager cache.

Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.evictAll()

refresh

void refresh(java.lang.Object entity)
             throws DataAccessException
Deprecated. 
Re-read the state of the given persistent instance.

Parameters:
entity - the persistent instance to re-read
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.refresh(Object)

refreshAll

void refreshAll(java.util.Collection entities)
                throws DataAccessException
Deprecated. 
Re-read the state of all given persistent instances.

Parameters:
entities - the persistent instances to re-read
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.refreshAll(java.util.Collection)

refreshAll

void refreshAll()
                throws DataAccessException
Deprecated. 
Re-read the state of all persistent instances.

Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.refreshAll()

makePersistent

<T> T makePersistent(T entity)
                 throws DataAccessException
Deprecated. 
Make the given transient instance persistent. Attach the given entity if the instance is detached.

Parameters:
entity - the transient instance to make persistent
Returns:
the persistent instance
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.makePersistent(Object)

makePersistentAll

<T> java.util.Collection<T> makePersistentAll(java.util.Collection<T> entities)
                                          throws DataAccessException
Deprecated. 
Make the given transient instances persistent. Attach the given entities if the instances are detached.

Parameters:
entities - the transient instances to make persistent
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.makePersistentAll(java.util.Collection)

deletePersistent

void deletePersistent(java.lang.Object entity)
                      throws DataAccessException
Deprecated. 
Delete the given persistent instance.

Parameters:
entity - the persistent instance to delete
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.deletePersistent(Object)

deletePersistentAll

void deletePersistentAll(java.util.Collection entities)
                         throws DataAccessException
Deprecated. 
Delete all given persistent instances.

This can be combined with any of the find methods to delete by query in two lines of code.

Parameters:
entities - the persistent instances to delete
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.deletePersistentAll(java.util.Collection)

detachCopy

<T> T detachCopy(T entity)
Deprecated. 
Detach a copy of the given persistent instance from the current JDO transaction, for use outside a JDO transaction (for example, as web form object).

Parameters:
entity - the persistent instance to detach
Returns:
the corresponding detached instance
See Also:
PersistenceManager.detachCopy(Object)

detachCopyAll

<T> java.util.Collection<T> detachCopyAll(java.util.Collection<T> entities)
Deprecated. 
Detach copies of the given persistent instances from the current JDO transaction, for use outside a JDO transaction (for example, as web form objects).

Parameters:
entities - the persistent instances to detach
Returns:
the corresponding detached instances
See Also:
PersistenceManager.detachCopyAll(Collection)

flush

void flush()
           throws DataAccessException
Deprecated. 
Flush all transactional modifications to the database.

Only invoke this for selective eager flushing, for example when JDBC code needs to see certain changes within the same transaction. Else, it's preferable to rely on auto-flushing at transaction completion.

Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.flush()

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class.

Parameters:
entityClass - a persistent class
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class)

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass,
                                 java.lang.String filter)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class that match the given JDOQL filter.

Parameters:
entityClass - a persistent class
filter - the JDOQL filter to match (or null if none)
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class, String)

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass,
                                 java.lang.String filter,
                                 java.lang.String ordering)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class that match the given JDOQL filter, with the given result ordering.

Parameters:
entityClass - a persistent class
filter - the JDOQL filter to match (or null if none)
ordering - the ordering of the result (or null if none)
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class, String), Query.setOrdering(java.lang.String)

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass,
                                 java.lang.String filter,
                                 java.lang.String parameters,
                                 java.lang.Object... values)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values.

Parameters:
entityClass - a persistent class
filter - the JDOQL filter to match
parameters - the JDOQL parameter declarations
values - the corresponding parameter values
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class, String), Query.declareParameters(java.lang.String), Query.executeWithArray(java.lang.Object...)

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass,
                                 java.lang.String filter,
                                 java.lang.String parameters,
                                 java.lang.Object[] values,
                                 java.lang.String ordering)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values, with the given result ordering.

Parameters:
entityClass - a persistent class
filter - the JDOQL filter to match
parameters - the JDOQL parameter declarations
values - the corresponding parameter values
ordering - the ordering of the result (or null if none)
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class, String), Query.declareParameters(java.lang.String), Query.executeWithArray(java.lang.Object...), Query.setOrdering(java.lang.String)

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass,
                                 java.lang.String filter,
                                 java.lang.String parameters,
                                 java.util.Map<java.lang.String,?> values)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values.

Parameters:
entityClass - a persistent class
filter - the JDOQL filter to match
parameters - the JDOQL parameter declarations
values - a Map with parameter names as keys and parameter values
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class, String), Query.declareParameters(java.lang.String), Query.executeWithMap(java.util.Map)

find

<T> java.util.Collection<T> find(java.lang.Class<T> entityClass,
                                 java.lang.String filter,
                                 java.lang.String parameters,
                                 java.util.Map<java.lang.String,?> values,
                                 java.lang.String ordering)
                             throws DataAccessException
Deprecated. 
Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values, with the given result ordering.

Parameters:
entityClass - a persistent class
filter - the JDOQL filter to match
parameters - the JDOQL parameter declarations
values - a Map with parameter names as keys and parameter values
ordering - the ordering of the result (or null if none)
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(Class, String), Query.declareParameters(java.lang.String), Query.executeWithMap(java.util.Map), Query.setOrdering(java.lang.String)

find

java.util.Collection find(java.lang.String language,
                          java.lang.Object queryObject)
                          throws DataAccessException
Deprecated. 
Find persistent instances through the given query object in the specified query language.

Parameters:
language - the query language (javax.jdo.Query#JDOQL or javax.jdo.Query#SQL, for example)
queryObject - the query object for the specified language
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(String, Object), Query.JDOQL, Query.SQL

find

java.util.Collection find(java.lang.String queryString)
                          throws DataAccessException
Deprecated. 
Find persistent instances through the given single-string JDOQL query.

Parameters:
queryString - the single-string JDOQL query
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(String)

find

java.util.Collection find(java.lang.String queryString,
                          java.lang.Object... values)
                          throws DataAccessException
Deprecated. 
Find persistent instances through the given single-string JDOQL query.

Parameters:
queryString - the single-string JDOQL query
values - the corresponding parameter values
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(String)

find

java.util.Collection find(java.lang.String queryString,
                          java.util.Map<java.lang.String,?> values)
                          throws DataAccessException
Deprecated. 
Find persistent instances through the given single-string JDOQL query.

Parameters:
queryString - the single-string JDOQL query
values - a Map with parameter names as keys and parameter values
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newQuery(String)

findByNamedQuery

<T> java.util.Collection<T> findByNamedQuery(java.lang.Class<T> entityClass,
                                             java.lang.String queryName)
                                         throws DataAccessException
Deprecated. 
Find persistent instances through the given named query.

Parameters:
entityClass - a persistent class
queryName - the name of the query
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newNamedQuery(Class, String)

findByNamedQuery

<T> java.util.Collection<T> findByNamedQuery(java.lang.Class<T> entityClass,
                                             java.lang.String queryName,
                                             java.lang.Object... values)
                                         throws DataAccessException
Deprecated. 
Find persistent instances through the given named query.

Parameters:
entityClass - a persistent class
queryName - the name of the query
values - the corresponding parameter values
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newNamedQuery(Class, String)

findByNamedQuery

<T> java.util.Collection<T> findByNamedQuery(java.lang.Class<T> entityClass,
                                             java.lang.String queryName,
                                             java.util.Map<java.lang.String,?> values)
                                         throws DataAccessException
Deprecated. 
Find persistent instances through the given named query.

Parameters:
entityClass - a persistent class
queryName - the name of the query
values - a Map with parameter names as keys and parameter values
Returns:
the persistent instances
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.newNamedQuery(Class, String)

Spring Framework