org.springframework.orm.jdo
Class JdoTemplate

java.lang.Object
  extended by org.springframework.orm.jdo.JdoAccessor
      extended by org.springframework.orm.jdo.JdoTemplate
All Implemented Interfaces:
InitializingBean, JdoOperations

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

@Deprecated
public class JdoTemplate
extends JdoAccessor
implements JdoOperations

Helper class that simplifies JDO data access code, and converts JDOExceptions into Spring DataAccessExceptions, following the org.springframework.dao exception hierarchy.

The central method is execute, supporting JDO access code implementing the JdoCallback interface. It provides JDO PersistenceManager handling such that neither the JdoCallback implementation nor the calling code needs to explicitly care about retrieving/closing PersistenceManagers, or handling JDO lifecycle exceptions.

Typically used to implement data access or business logic services that use JDO within their implementation but are JDO-agnostic in their interface. The latter or code calling the latter only have to deal with business objects, query objects, and org.springframework.dao exceptions.

Can be used within a service implementation via direct instantiation with a PersistenceManagerFactory reference, or get prepared in an application context and given to services as bean reference. Note: The PersistenceManagerFactory should always be configured as bean in the application context, in the first case given to the service directly, in the second case to the prepared template.

This class can be considered as direct alternative to working with the raw JDO PersistenceManager API (through PersistenceManagerFactoryUtils.getPersistenceManager()). The major advantage is its automatic conversion to DataAccessExceptions, the major disadvantage that no checked application exceptions can get thrown from within data access code. Corresponding checks and the actual throwing of such exceptions can often be deferred to after callback execution, though.

LocalPersistenceManagerFactoryBean is the preferred way of obtaining a reference to a specific PersistenceManagerFactory, at least in a non-EJB environment. The Spring application context will manage its lifecycle, initializing and shutting down the factory as part of the application.

Note that lazy loading will just work with an open JDO PersistenceManager, either within a Spring-driven transaction (with JdoTransactionManager or JtaTransactionManager) or within OpenPersistenceManagerInViewFilter/Interceptor. Furthermore, some operations just make sense within transactions, for example: evict, evictAll, flush.

NOTE: This class requires JDO 2.0 or higher, as of Spring 2.5. As of Spring 3.0, it follows JDO 2.1 conventions in terms of generic parameter and return types, which still remaining compatible with JDO 2.0.

Since:
03.06.2003
Author:
Juergen Hoeller
See Also:
JdoAccessor.setPersistenceManagerFactory(javax.jdo.PersistenceManagerFactory), JdoCallback, PersistenceManager, LocalPersistenceManagerFactoryBean, JdoTransactionManager, JtaTransactionManager, OpenPersistenceManagerInViewFilter, OpenPersistenceManagerInViewInterceptor

Field Summary
 
Fields inherited from class org.springframework.orm.jdo.JdoAccessor
logger
 
Constructor Summary
JdoTemplate()
          Deprecated. Create a new JdoTemplate instance.
JdoTemplate(javax.jdo.PersistenceManagerFactory pmf)
          Deprecated. Create a new JdoTemplate instance.
JdoTemplate(javax.jdo.PersistenceManagerFactory pmf, boolean allowCreate)
          Deprecated. Create a new JdoTemplate instance.
 
Method Summary
protected  javax.jdo.PersistenceManager createPersistenceManagerProxy(javax.jdo.PersistenceManager pm)
          Deprecated. Create a close-suppressing proxy for the given JDO PersistenceManager.
 void deletePersistent(Object entity)
          Deprecated. Delete the given persistent instance.
 void deletePersistentAll(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> Collection<T>
detachCopyAll(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(Object entity)
          Deprecated. Remove the given object from the PersistenceManager cache.
 void evictAll()
          Deprecated. Remove all objects from the PersistenceManager cache.
 void evictAll(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.
<T> T
execute(JdoCallback<T> action, boolean exposeNativePersistenceManager)
          Deprecated. Execute the action specified by the given action object within a PersistenceManager.
 Collection executeFind(JdoCallback<?> action)
          Deprecated. Execute the specified action assuming that the result object is a Collection.
<T> Collection<T>
find(Class<T> entityClass)
          Deprecated. Find all persistent instances of the given class.
<T> Collection<T>
find(Class<T> entityClass, String filter)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter.
<T> Collection<T>
find(Class<T> entityClass, String filter, String ordering)
          Deprecated. Find all persistent instances of the given class that match the given JDOQL filter, with the given result ordering.
<T> Collection<T>
find(Class<T> entityClass, String filter, String parameters, Map<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> Collection<T>
find(Class<T> entityClass, String filter, String parameters, Map<String,?> values, 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> Collection<T>
find(Class<T> entityClass, String filter, String parameters, 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> Collection<T>
find(Class<T> entityClass, String filter, String parameters, Object[] values, 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.
 Collection find(String queryString)
          Deprecated. Find persistent instances through the given single-string JDOQL query.
 Collection find(String queryString, Map<String,?> values)
          Deprecated. Find persistent instances through the given single-string JDOQL query.
 Collection find(String queryString, Object... values)
          Deprecated. Find persistent instances through the given single-string JDOQL query.
 Collection find(String language, Object queryObject)
          Deprecated. Find persistent instances through the given query object in the specified query language.
<T> Collection<T>
findByNamedQuery(Class<T> entityClass, String queryName)
          Deprecated. Find persistent instances through the given named query.
<T> Collection<T>
findByNamedQuery(Class<T> entityClass, String queryName, Map<String,?> values)
          Deprecated. Find persistent instances through the given named query.
<T> Collection<T>
findByNamedQuery(Class<T> entityClass, String queryName, Object... values)
          Deprecated. Find persistent instances through the given named query.
 void flush()
          Deprecated. Flush all transactional modifications to the database.
<T> T
getObjectById(Class<T> entityClass, Object idValue)
          Deprecated. Return the persistent instance of the given entity class with the given id value, throwing an exception if not found.
 Object getObjectById(Object objectId)
          Deprecated. Return the persistent instance with the given JDO object id, throwing an exception if not found.
 boolean isAllowCreate()
          Deprecated. Return if a new PersistenceManager should be created if no thread-bound found.
 boolean isExposeNativePersistenceManager()
          Deprecated. Return whether to expose the native JDO PersistenceManager to JdoCallback code, or rather a PersistenceManager proxy.
<T> T
makePersistent(T entity)
          Deprecated. Make the given transient instance persistent.
<T> Collection<T>
makePersistentAll(Collection<T> entities)
          Deprecated. Make the given transient instances persistent.
protected
<T> T
postProcessResult(T result, javax.jdo.PersistenceManager pm, boolean existingTransaction)
          Deprecated. Post-process the given result object, which might be a Collection.
 void prepareQuery(javax.jdo.Query query)
          Deprecated. Prepare the given JDO query object.
 void refresh(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(Collection entities)
          Deprecated. Re-read the state of all given persistent instances.
 void setAllowCreate(boolean allowCreate)
          Deprecated. Set if a new PersistenceManager should be created when no transactional PersistenceManager can be found for the current thread.
 void setExposeNativePersistenceManager(boolean exposeNativePersistenceManager)
          Deprecated. Set whether to expose the native JDO PersistenceManager to JdoCallback code.
 
Methods inherited from class org.springframework.orm.jdo.JdoAccessor
afterPropertiesSet, convertJdoAccessException, flushIfNecessary, getJdoDialect, getPersistenceManagerFactory, isFlushEager, setFlushEager, setJdoDialect, setPersistenceManagerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdoTemplate

public JdoTemplate()
Deprecated. 
Create a new JdoTemplate instance.


JdoTemplate

public JdoTemplate(javax.jdo.PersistenceManagerFactory pmf)
Deprecated. 
Create a new JdoTemplate instance.

Parameters:
pmf - PersistenceManagerFactory to create PersistenceManagers

JdoTemplate

public JdoTemplate(javax.jdo.PersistenceManagerFactory pmf,
                   boolean allowCreate)
Deprecated. 
Create a new JdoTemplate instance.

Parameters:
pmf - PersistenceManagerFactory to create PersistenceManagers
allowCreate - if a non-transactional PersistenceManager should be created when no transactional PersistenceManager can be found for the current thread
Method Detail

setAllowCreate

public void setAllowCreate(boolean allowCreate)
Deprecated. 
Set if a new PersistenceManager should be created when no transactional PersistenceManager can be found for the current thread.

JdoTemplate is aware of a corresponding PersistenceManager bound to the current thread, for example when using JdoTransactionManager. If allowCreate is true, a new non-transactional PersistenceManager will be created if none found, which needs to be closed at the end of the operation. If false, an IllegalStateException will get thrown in this case.

See Also:
PersistenceManagerFactoryUtils.getPersistenceManager(javax.jdo.PersistenceManagerFactory, boolean)

isAllowCreate

public boolean isAllowCreate()
Deprecated. 
Return if a new PersistenceManager should be created if no thread-bound found.


setExposeNativePersistenceManager

public void setExposeNativePersistenceManager(boolean exposeNativePersistenceManager)
Deprecated. 
Set whether to expose the native JDO PersistenceManager to JdoCallback code. Default is "false": a PersistenceManager proxy will be returned, suppressing close calls and automatically applying transaction timeouts (if any).

As there is often a need to cast to a provider-specific PersistenceManager class in DAOs that use provider-specific functionality, the exposed proxy implements all interfaces implemented by the original PersistenceManager. If this is not sufficient, turn this flag to "true".

See Also:
JdoCallback, PersistenceManager, prepareQuery(javax.jdo.Query)

isExposeNativePersistenceManager

public boolean isExposeNativePersistenceManager()
Deprecated. 
Return whether to expose the native JDO PersistenceManager to JdoCallback code, or rather a PersistenceManager proxy.


execute

public <T> T execute(JdoCallback<T> action)
          throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
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.

Specified by:
execute in interface JdoOperations
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

public Collection executeFind(JdoCallback<?> action)
                       throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Execute the specified action assuming that the result object is a Collection. This is a convenience method for executing JDO queries within an action.

Specified by:
executeFind in interface JdoOperations
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

execute

public <T> T execute(JdoCallback<T> action,
                     boolean exposeNativePersistenceManager)
          throws DataAccessException
Deprecated. 
Execute the action specified by the given action object within a PersistenceManager.

Parameters:
action - callback object that specifies the JDO action
exposeNativePersistenceManager - whether to expose the native JDO persistence manager to callback code
Returns:
a result object returned by the action, or null
Throws:
DataAccessException - in case of JDO errors

createPersistenceManagerProxy

protected javax.jdo.PersistenceManager createPersistenceManagerProxy(javax.jdo.PersistenceManager pm)
Deprecated. 
Create a close-suppressing proxy for the given JDO PersistenceManager. Called by the execute method.

The proxy also prepares returned JDO Query objects.

Parameters:
pm - the JDO PersistenceManager to create a proxy for
Returns:
the PersistenceManager proxy, implementing all interfaces implemented by the passed-in PersistenceManager object (that is, also implementing all provider-specific extension interfaces)
See Also:
PersistenceManager.close(), execute(JdoCallback, boolean), prepareQuery(javax.jdo.Query)

postProcessResult

protected <T> T postProcessResult(T result,
                                  javax.jdo.PersistenceManager pm,
                                  boolean existingTransaction)
Deprecated. 
Post-process the given result object, which might be a Collection. Called by the execute method.

Default implementation always returns the passed-in Object as-is. Subclasses might override this to automatically detach result collections or even single result objects.

Parameters:
pm - the current JDO PersistenceManager
result - the result object (might be a Collection)
existingTransaction - if executing within an existing transaction (within an existing JDO PersistenceManager that won't be closed immediately)
Returns:
the post-processed result object (can be simply be the passed-in object)
See Also:
execute(JdoCallback, boolean)

getObjectById

public Object getObjectById(Object objectId)
                     throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
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.

Specified by:
getObjectById in interface JdoOperations
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

public <T> T getObjectById(Class<T> entityClass,
                           Object idValue)
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
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.

Specified by:
getObjectById in interface JdoOperations
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

public void evict(Object entity)
           throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Remove the given object from the PersistenceManager cache.

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

evictAll

public void evictAll(Collection entities)
              throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Remove all given objects from the PersistenceManager cache.

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

evictAll

public void evictAll()
              throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Remove all objects from the PersistenceManager cache.

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

refresh

public void refresh(Object entity)
             throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Re-read the state of the given persistent instance.

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

refreshAll

public void refreshAll(Collection entities)
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Re-read the state of all given persistent instances.

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

refreshAll

public void refreshAll()
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Re-read the state of all persistent instances.

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

makePersistent

public <T> T makePersistent(T entity)
                 throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Make the given transient instance persistent. Attach the given entity if the instance is detached.

Specified by:
makePersistent in interface JdoOperations
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

public <T> Collection<T> makePersistentAll(Collection<T> entities)
                                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Make the given transient instances persistent. Attach the given entities if the instances are detached.

Specified by:
makePersistentAll in interface JdoOperations
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

public void deletePersistent(Object entity)
                      throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Delete the given persistent instance.

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

deletePersistentAll

public void deletePersistentAll(Collection entities)
                         throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Delete all given persistent instances.

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

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

detachCopy

public <T> T detachCopy(T entity)
Deprecated. 
Description copied from interface: JdoOperations
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).

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

detachCopyAll

public <T> Collection<T> detachCopyAll(Collection<T> entities)
Deprecated. 
Description copied from interface: JdoOperations
Detach copies of the given persistent instances from the current JDO transaction, for use outside a JDO transaction (for example, as web form objects).

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

flush

public void flush()
           throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
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.

Specified by:
flush in interface JdoOperations
Throws:
DataAccessException - in case of JDO errors
See Also:
PersistenceManager.flush(), JdoDialect#flush(javax.jdo.PersistenceManager)

find

public <T> Collection<T> find(Class<T> entityClass)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find all persistent instances of the given class.

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

find

public <T> Collection<T> find(Class<T> entityClass,
                              String filter)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find all persistent instances of the given class that match the given JDOQL filter.

Specified by:
find in interface JdoOperations
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

public <T> Collection<T> find(Class<T> entityClass,
                              String filter,
                              String ordering)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find all persistent instances of the given class that match the given JDOQL filter, with the given result ordering.

Specified by:
find in interface JdoOperations
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

public <T> Collection<T> find(Class<T> entityClass,
                              String filter,
                              String parameters,
                              Object... values)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values.

Specified by:
find in interface JdoOperations
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

public <T> Collection<T> find(Class<T> entityClass,
                              String filter,
                              String parameters,
                              Object[] values,
                              String ordering)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
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.

Specified by:
find in interface JdoOperations
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

public <T> Collection<T> find(Class<T> entityClass,
                              String filter,
                              String parameters,
                              Map<String,?> values)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find all persistent instances of the given class that match the given JDOQL filter, using the given parameter declarations and parameter values.

Specified by:
find in interface JdoOperations
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

public <T> Collection<T> find(Class<T> entityClass,
                              String filter,
                              String parameters,
                              Map<String,?> values,
                              String ordering)
                   throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
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.

Specified by:
find in interface JdoOperations
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

public Collection find(String language,
                       Object queryObject)
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given query object in the specified query language.

Specified by:
find in interface JdoOperations
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

public Collection find(String queryString)
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given single-string JDOQL query.

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

find

public Collection find(String queryString,
                       Object... values)
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given single-string JDOQL query.

Specified by:
find in interface JdoOperations
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

public Collection find(String queryString,
                       Map<String,?> values)
                throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given single-string JDOQL query.

Specified by:
find in interface JdoOperations
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

public <T> Collection<T> findByNamedQuery(Class<T> entityClass,
                                          String queryName)
                               throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given named query.

Specified by:
findByNamedQuery in interface JdoOperations
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

public <T> Collection<T> findByNamedQuery(Class<T> entityClass,
                                          String queryName,
                                          Object... values)
                               throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given named query.

Specified by:
findByNamedQuery in interface JdoOperations
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

public <T> Collection<T> findByNamedQuery(Class<T> entityClass,
                                          String queryName,
                                          Map<String,?> values)
                               throws DataAccessException
Deprecated. 
Description copied from interface: JdoOperations
Find persistent instances through the given named query.

Specified by:
findByNamedQuery in interface JdoOperations
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)

prepareQuery

public void prepareQuery(javax.jdo.Query query)
                  throws javax.jdo.JDOException
Deprecated. 
Prepare the given JDO query object. To be used within a JdoCallback.

Applies a transaction timeout, if any. If you don't use such timeouts, the call is a no-op.

In general, prefer a proxied PersistenceManager instead, which will automatically apply the transaction timeout (through the use of a special PersistenceManager proxy). You need to set the "exposeNativePersistenceManager" property to "false" to activate this. Note that you won't be able to cast to a provider-specific JDO PersistenceManager class anymore then.

Parameters:
query - the JDO query object
Throws:
javax.jdo.JDOException - if the query could not be properly prepared
See Also:
JdoCallback.doInJdo(javax.jdo.PersistenceManager), PersistenceManagerFactoryUtils.applyTransactionTimeout(javax.jdo.Query, javax.jdo.PersistenceManagerFactory, org.springframework.orm.jdo.JdoDialect), setExposeNativePersistenceManager(boolean)