it.openutils.dao.hibernate
Class HibernateDAOImpl<T,K extends Serializable>

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by it.openutils.dao.hibernate.HibernateDAOImpl<T,K>
Type Parameters:
T - Persistence class
K - Object Key
All Implemented Interfaces:
HibernateDAO<T,K>, org.springframework.beans.factory.InitializingBean

public abstract class HibernateDAOImpl<T,K extends Serializable>
extends org.springframework.orm.hibernate3.support.HibernateDaoSupport
implements HibernateDAO<T,K>

Base Hibernate DAO.

Version:
$Id: HibernateDAOImpl.java 3499 2011-06-04 08:01:45Z fgiust $
Author:
Fabrizio Giustina

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HibernateDAOImpl()
          Instantiates a new DAO instance
HibernateDAOImpl(Class<T> referenceClass)
          Sets the class of the persistent bean managed by this DAO
 
Method Summary
 boolean delete(K key)
          Used by the base DAO classes but here for your modification.
 void evict(T obj)
          Remove the given object from the Session cache.
 List<T> find(List<? extends org.hibernate.criterion.Criterion> criteria, org.hibernate.criterion.Order... orders)
          Retrieve the entities handled by this DAO that match the input criteria, ordered according to the input orders.
 List<T> find(String query)
          Retrieve all entities handled by this DAO that match the input query string.
 List<T> find(String query, Object[] paramValues, org.hibernate.type.Type[] paramTypes)
          Retrieve all entities handled by this DAO that match the input query string, accepting one query parameter and the corresponding type.
 List<T> find(String query, Object paramValue, org.hibernate.type.Type paramType)
          Retrieve all entities handled by this DAO that match the input query string, accepting one query parameter and the corresponding type.
 List<T> findAll()
          Retrieve all entities handled by this DAO, in no particular order.
 List<T> findAll(org.hibernate.criterion.Order... orders)
          Retrieve all entities handled by this DAO, ordered according to the input orders.
 List<T> findAll(org.hibernate.criterion.Order[] orders, List<? extends org.hibernate.criterion.Criterion> criteria)
          Deprecated. 
protected  List<?> findByNamedQuery(String name, Map<String,?> params, Integer maxResults)
          Obtain an instance of Query for a named query string defined in the mapping file.
protected  List<?> findByNamedQuery(String name, Serializable[] params, Integer maxResults)
          Obtain an instance of Query for a named query string defined in the mapping file.
 List<T> findFiltered(T filter)
          Retrieve the entities handled by this DAO whose property values match, via equals(), filter's non-null property values.
 List<T> findFiltered(T filter, int maxResults, int page)
          Retrieve the entities handled by this DAO whose property values match, via equals(), filter's non-null property values.
 List<T> findFiltered(T filter, Map<String,? extends FilterMetadata> metadata)
          Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values.
 List<T> findFiltered(T filter, Map<String,? extends FilterMetadata> metadata, int maxResults, int page)
          Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values.
 List<T> findFiltered(T filter, Map<String,? extends FilterMetadata> metadata, int maxResults, int page, List<? extends org.hibernate.criterion.Criterion> criteria, org.hibernate.criterion.Order... orders)
          Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values, and the input criteria.
 List<T> findFiltered(T filter, Map<String,? extends FilterMetadata> metadata, int maxResults, int page, org.hibernate.criterion.Order... orders)
          Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values.
 List<T> findFiltered(T filter, org.hibernate.criterion.Order... orders)
          Retrieve the entities handled by this DAO whose property values match, via equals(), filter's non-null property values.
 List<T> findFiltered(T filter, org.hibernate.criterion.Order[] customOrder, Map<String,? extends FilterMetadata> metadata, int maxResults, int page)
          Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values.
 List<T> findFiltered(T filter, org.hibernate.criterion.Order[] orders, Map<String,? extends FilterMetadata> metadata, int maxResults, int page, List<? extends org.hibernate.criterion.Criterion> criteria)
          Deprecated. 
 T findFilteredFirst(T filter)
          Retrieve the first entity instance that matches the input filter, if existing.
 T findFilteredFirst(T filter, List<? extends org.hibernate.criterion.Criterion> criteria)
          Retrieve the first entity instance that matches the input filter and the additional input criteria, if existing.
 T findFilteredFirst(T filter, org.hibernate.criterion.Order... orders)
          Retrieve the first entity instance that matches the input filter, if existing.
 List<?> findFilteredProperties(T filter, Map<String,? extends FilterMetadata> metadata, int maxResults, int page, List<? extends org.hibernate.criterion.Criterion> criteria, List<String> properties, org.hibernate.criterion.Order... orders)
          Retrieve a set of properties from the entities returned by HibernateDAO.findFiltered(Object, Order[], Map, int, int, List)
 List<?> findFilteredProperties(T filter, org.hibernate.criterion.Order[] orders, Map<String,? extends FilterMetadata> metadata, int maxResults, int page, List<? extends org.hibernate.criterion.Criterion> criteria, List<String> properties)
          Deprecated. 
 T get(K key)
          Load object matching the given key and return it.
protected  Map<String,? extends FilterMetadata> getDefaultFilterMetadata()
          Returns the default set of FilterMetadata that will be applied to any query.
protected  org.hibernate.criterion.Order[] getDefaultOrder()
          Return a list of Order object to be used for the default ordering of the collection.
protected  List<?> getNamedQuery(String name, Map<String,?> params, int maxResults)
          Deprecated. use the better named findByNamedQuery method
protected  List<?> getNamedQuery(String name, Serializable[] params, int maxResults)
          Deprecated. use the better named findByNamedQuery method
protected  Class<T> getReferenceClass()
          Return the specific Object class that will be used for class-specific implementation of this DAO.
 T load(K key)
          Load object matching the given key and return it.
 T loadIfAvailable(K key)
          Load object matching the given key and return it.
 T merge(T obj)
          Copies the state of the given object onto the persistent object with the same identifier, and returns the updated persistent instance.
 void refresh(T obj)
          Re-reads the state of the given instance from the underlying database.
 K save(T obj)
          Persist the given transient instance, first assigning a generated identifier.
 void saveOrUpdate(T obj)
          Used by the base DAO classes but here for your modification Either save() or update() the given instance, depending upon the value of its identifier property.
 void setAopenabled(boolean aopenabled)
          Sets the aopenabled.
protected  void setParameterValue(org.hibernate.Query query, String key, Object value)
          Convenience method to set paramers in the query given based on the actual object type in passed in as the value.
 void setReferenceClass(Class<T> referenceClass)
           
 void update(T obj)
          Used by the base DAO classes but here for your modification Update the persistent state associated with the given identifier.
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateDAOImpl

public HibernateDAOImpl()
Instantiates a new DAO instance


HibernateDAOImpl

public HibernateDAOImpl(Class<T> referenceClass)
Sets the class of the persistent bean managed by this DAO

Parameters:
referenceClass - the class for the bean managed by this DAO
Method Detail

findAll

public List<T> findAll()
Retrieve all entities handled by this DAO, in no particular order.

Specified by:
findAll in interface HibernateDAO<T,K extends Serializable>
Returns:
the list of all entity instances (never null)

findAll

public List<T> findAll(org.hibernate.criterion.Order... orders)
Retrieve all entities handled by this DAO, ordered according to the input orders.

Specified by:
findAll in interface HibernateDAO<T,K extends Serializable>
Parameters:
orders - the orders to apply with respect to entity class properties
Returns:
the list of all entity instances (never null), ordered accordingly

find

public List<T> find(List<? extends org.hibernate.criterion.Criterion> criteria,
                    org.hibernate.criterion.Order... orders)
Retrieve the entities handled by this DAO that match the input criteria, ordered according to the input orders.

Specified by:
find in interface HibernateDAO<T,K extends Serializable>
Parameters:
criteria - a list of additional Hibernate criteria
orders - the orders to apply with respect to entity class properties
Returns:
a list of distinct entity instances (never null), matching the criteria and ordered accordingly

find

public List<T> find(String query)
Retrieve all entities handled by this DAO that match the input query string.

Specified by:
find in interface HibernateDAO<T,K extends Serializable>
Parameters:
query - an HQL query
Returns:
a list of distinct entity instances (never null)

find

public List<T> find(String query,
                    Object paramValue,
                    org.hibernate.type.Type paramType)
Retrieve all entities handled by this DAO that match the input query string, accepting one query parameter and the corresponding type.

Specified by:
find in interface HibernateDAO<T,K extends Serializable>
Parameters:
query - an HQL query
paramValue - the value of a parameter to be set in the query
paramType - the Hibernate type of paramValue
Returns:
a list of distinct entity instances (never null)

find

public List<T> find(String query,
                    Object[] paramValues,
                    org.hibernate.type.Type[] paramTypes)
Retrieve all entities handled by this DAO that match the input query string, accepting one query parameter and the corresponding type.

Specified by:
find in interface HibernateDAO<T,K extends Serializable>
Parameters:
query - an HQL query
paramValues - the parameter values to be set in the query
paramTypes - the Hibernate types of paramValues
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter)
Retrieve the entities handled by this DAO whose property values match, via equals(), filter's non-null property values.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter,
                            org.hibernate.criterion.Order... orders)
Retrieve the entities handled by this DAO whose property values match, via equals(), filter's non-null property values. The result list is ordered according to the input orders parameter.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
orders - the orders to apply with respect to entity class properties
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter,
                            int maxResults,
                            int page)
Retrieve the entities handled by this DAO whose property values match, via equals(), filter's non-null property values.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter,
                            Map<String,? extends FilterMetadata> metadata)
Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter,
                            Map<String,? extends FilterMetadata> metadata,
                            int maxResults,
                            int page)
Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
Returns:
a list of distinct entity instances (never null)

findFilteredFirst

public T findFilteredFirst(T filter)
Retrieve the first entity instance that matches the input filter, if existing.

Specified by:
findFilteredFirst in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
Returns:
the first matching instance of the entity class managed by this DAO, or null if none found
See Also:
#findFiltered(T)

findFilteredFirst

public T findFilteredFirst(T filter,
                           org.hibernate.criterion.Order... orders)
Retrieve the first entity instance that matches the input filter, if existing.

Specified by:
findFilteredFirst in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
orders - the orders to apply with respect to entity class properties
Returns:
the first matching instance of the entity class managed by this DAO, or null if none found
See Also:
#findFiltered(T, Order...)

findFilteredFirst

public T findFilteredFirst(T filter,
                           List<? extends org.hibernate.criterion.Criterion> criteria)
Retrieve the first entity instance that matches the input filter and the additional input criteria, if existing.

Specified by:
findFilteredFirst in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
criteria - a list of additional Hibernate criteria
Returns:
the first matching instance of the entity class managed by this DAO, or null if none found
See Also:
#findFiltered(T, List)

load

public T load(K key)
Load object matching the given key and return it. Throw an exception if not found.

Specified by:
load in interface HibernateDAO<T,K extends Serializable>
Parameters:
key - the id of the entity instance to load
Returns:
the found entity instance (never null)

loadIfAvailable

public T loadIfAvailable(K key)
Load object matching the given key and return it. Lazy object will be initialized.

Specified by:
loadIfAvailable in interface HibernateDAO<T,K extends Serializable>
Parameters:
key - the id of the entity instance to load
Returns:
the found entity instance, or null if none found

get

public T get(K key)
Load object matching the given key and return it. Lazy object will be initialized.

Specified by:
get in interface HibernateDAO<T,K extends Serializable>
Parameters:
key - the id of the entity instance to load
Returns:
the found entity instance (never null)

save

public K save(T obj)
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.)

Specified by:
save in interface HibernateDAO<T,K extends Serializable>
Parameters:
obj - the entity instance to save
Returns:
the id generated for the persisted instance

update

public void update(T obj)
Used by the base DAO classes but here for your modification Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent instance with the same identifier in the current session.

Specified by:
update in interface HibernateDAO<T,K extends Serializable>
Parameters:
obj - a transient instance containing updated state

saveOrUpdate

public void saveOrUpdate(T obj)
Used by the base DAO classes but here for your modification Either save() or update() the given instance, depending upon the value of its identifier property.

Specified by:
saveOrUpdate in interface HibernateDAO<T,K extends Serializable>
Parameters:
obj - Object

delete

public boolean delete(K key)
Used by the base DAO classes but here for your modification. Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state.

Specified by:
delete in interface HibernateDAO<T,K extends Serializable>
Parameters:
key - key
Returns:
true if the object was successfully deleted, false otherwise

refresh

public void refresh(T obj)
Re-reads the state of the given instance from the underlying database. This method is useful in certain special circumstances, for example: However, use of this method in long-running sessions that span many business tasks is discouraged.

Specified by:
refresh in interface HibernateDAO<T,K extends Serializable>
Parameters:
obj - the entity instance to refresh

evict

public void evict(T obj)
Remove the given object from the Session cache.

Specified by:
evict in interface HibernateDAO<T,K extends Serializable>
Parameters:
obj - the entity instance to remove

merge

public T merge(T obj)
Copies the state of the given object onto the persistent object with the same identifier, and returns the updated persistent instance. If there is no persistent instance currently associated with the session, a new one will be loaded. If the given instance is unsaved, saves a copy of and return it as a newly persisted instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped with cascade="merge".

The semantics of this method are defined by JSR-220.

Specified by:
merge in interface HibernateDAO<T,K extends Serializable>
Parameters:
obj - a detached instance with state to be copied
Returns:
an updated persistent instance

findAll

@Deprecated
public List<T> findAll(org.hibernate.criterion.Order[] orders,
                                  List<? extends org.hibernate.criterion.Criterion> criteria)
Deprecated. 

Return all objects related to the implementation of this DAO with no filter.

Specified by:
findAll in interface HibernateDAO<T,K extends Serializable>
Parameters:
orders - desc or asc
criteria - Additional Criterion conditions
Returns:
a list of all instances

findFiltered

public List<T> findFiltered(T filter,
                            org.hibernate.criterion.Order[] customOrder,
                            Map<String,? extends FilterMetadata> metadata,
                            int maxResults,
                            int page)
Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values. The result list is ordered according to the orders parameter.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
customOrder - the orders to apply with respect to entity class properties
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter,
                            Map<String,? extends FilterMetadata> metadata,
                            int maxResults,
                            int page,
                            org.hibernate.criterion.Order... orders)
Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values. The result list is ordered according to the orders parameter.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
orders - the orders to apply with respect to entity class properties
Returns:
a list of distinct entity instances (never null)

findFiltered

public List<T> findFiltered(T filter,
                            Map<String,? extends FilterMetadata> metadata,
                            int maxResults,
                            int page,
                            List<? extends org.hibernate.criterion.Criterion> criteria,
                            org.hibernate.criterion.Order... orders)
Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values, and the input criteria.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
criteria - a list of additional Hibernate criteria
orders - the orders to apply with respect to entity class properties
Returns:
a list of distinct entity instances (never null)

findFilteredProperties

public List<?> findFilteredProperties(T filter,
                                      Map<String,? extends FilterMetadata> metadata,
                                      int maxResults,
                                      int page,
                                      List<? extends org.hibernate.criterion.Criterion> criteria,
                                      List<String> properties,
                                      org.hibernate.criterion.Order... orders)
Retrieve a set of properties from the entities returned by HibernateDAO.findFiltered(Object, Order[], Map, int, int, List)

Specified by:
findFilteredProperties in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
criteria - a list of additional Hibernate criteria
properties - the names of the properties to return
orders - the orders to apply with respect to entity class properties
Returns:
a list of distinct entity instances (never null)

findFiltered

@Deprecated
public List<T> findFiltered(T filter,
                                       org.hibernate.criterion.Order[] orders,
                                       Map<String,? extends FilterMetadata> metadata,
                                       int maxResults,
                                       int page,
                                       List<? extends org.hibernate.criterion.Criterion> criteria)
Deprecated. 

Retrieve the entities handled by this DAO whose property values match, via equals() or via a specified FilterMetadata object, filter's non-null property values, and the input criteria.

Specified by:
findFiltered in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
orders - the orders to apply with respect to entity class properties
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
criteria - a list of additional Hibernate criteria
Returns:
a list of distinct entity instances (never null)

findFilteredProperties

@Deprecated
public List<?> findFilteredProperties(T filter,
                                                 org.hibernate.criterion.Order[] orders,
                                                 Map<String,? extends FilterMetadata> metadata,
                                                 int maxResults,
                                                 int page,
                                                 List<? extends org.hibernate.criterion.Criterion> criteria,
                                                 List<String> properties)
Deprecated. 

Retrieve a set of properties from the entities returned by HibernateDAO.findFiltered(Object, Order[], Map, int, int, List)

Specified by:
findFilteredProperties in interface HibernateDAO<T,K extends Serializable>
Parameters:
filter - an instance of this DAO's entity class to be used as filter
orders - the orders to apply with respect to entity class properties
metadata - a map that matches names of entity class properties to FilterMetadata modifiers, that will be used for comparing values of the corresponding property
maxResults - the maximum number of results to be fetched
page - the zero-based page number to use when displaying paginated results (the first entity returned is the one at position maxResults * page in the complete list of results), or 0 for no pagination
criteria - a list of additional Hibernate criteria
properties - the names of the properties to return
Returns:
a list of distinct entity instances (never null)

setAopenabled

public void setAopenabled(boolean aopenabled)
Sets the aopenabled.

Parameters:
aopenabled - the aopenabled to set

setReferenceClass

public void setReferenceClass(Class<T> referenceClass)

getReferenceClass

protected Class<T> getReferenceClass()
Return the specific Object class that will be used for class-specific implementation of this DAO.

Returns:
the reference Class

getDefaultOrder

protected org.hibernate.criterion.Order[] getDefaultOrder()
Return a list of Order object to be used for the default ordering of the collection.

Returns:
the property name

findByNamedQuery

protected List<?> findByNamedQuery(String name,
                                   Serializable[] params,
                                   Integer maxResults)
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
name - the name of a query defined externally
params - the parameter array
maxResults - max number of results
Returns:
Query

findByNamedQuery

protected List<?> findByNamedQuery(String name,
                                   Map<String,?> params,
                                   Integer maxResults)
Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
name - the name of a query defined externally
params - the parameter Map
maxResults - max number of results
Returns:
Query

getNamedQuery

@Deprecated
protected List<?> getNamedQuery(String name,
                                           Serializable[] params,
                                           int maxResults)
Deprecated. use the better named findByNamedQuery method

Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
name - the name of a query defined externally
params - the parameter array
maxResults - max number of results
Returns:
Query

getNamedQuery

@Deprecated
protected List<?> getNamedQuery(String name,
                                           Map<String,?> params,
                                           int maxResults)
Deprecated. use the better named findByNamedQuery method

Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.

Parameters:
name - the name of a query defined externally
params - the parameter Map
maxResults - max number of results
Returns:
Query

setParameterValue

protected void setParameterValue(org.hibernate.Query query,
                                 String key,
                                 Object value)
Convenience method to set paramers in the query given based on the actual object type in passed in as the value. You may need to add more functionaly to this as desired (or not use this at all).

Parameters:
query - the Query to set
key - the key name
value - the object to set as the parameter

getDefaultFilterMetadata

protected Map<String,? extends FilterMetadata> getDefaultFilterMetadata()
Returns the default set of FilterMetadata that will be applied to any query. The default implementation doesn't set any default filter, subclasses may override this.

Returns:
map of property name - filter metadata


Copyright © 2005-2011 Openmind. All Rights Reserved.