|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
it.openutils.dao.hibernate.HibernateDAOImpl<T,K>
T - Persistence classK - Object Keypublic abstract class HibernateDAOImpl<T,K extends Serializable>
Base Hibernate DAO.
| 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 |
|---|
public HibernateDAOImpl()
public HibernateDAOImpl(Class<T> referenceClass)
referenceClass - the class for the bean managed by this DAO| Method Detail |
|---|
public List<T> findAll()
findAll in interface HibernateDAO<T,K extends Serializable>public List<T> findAll(org.hibernate.criterion.Order... orders)
orders.
findAll in interface HibernateDAO<T,K extends Serializable>orders - the orders to apply with respect to entity class properties
public List<T> find(List<? extends org.hibernate.criterion.Criterion> criteria,
org.hibernate.criterion.Order... orders)
criteria, ordered according to the
input orders.
find in interface HibernateDAO<T,K extends Serializable>criteria - a list of additional Hibernate criteriaorders - the orders to apply with respect to entity class properties
public List<T> find(String query)
find in interface HibernateDAO<T,K extends Serializable>query - an HQL query
public List<T> find(String query,
Object paramValue,
org.hibernate.type.Type paramType)
find in interface HibernateDAO<T,K extends Serializable>query - an HQL queryparamValue - the value of a parameter to be set in the queryparamType - the Hibernate type of paramValue
public List<T> find(String query,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes)
find in interface HibernateDAO<T,K extends Serializable>query - an HQL queryparamValues - the parameter values to be set in the queryparamTypes - the Hibernate types of paramValues
public List<T> findFiltered(T filter)
equals(),
filter's non-null property values.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filter
public List<T> findFiltered(T filter,
org.hibernate.criterion.Order... orders)
equals(),
filter's non-null property values. The result list is ordered according to the input
orders parameter.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filterorders - the orders to apply with respect to entity class properties
public List<T> findFiltered(T filter,
int maxResults,
int page)
equals(),
filter's non-null property values.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtermaxResults - the maximum number of results to be fetchedpage - 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
public List<T> findFiltered(T filter,
Map<String,? extends FilterMetadata> metadata)
equals() or via a
specified FilterMetadata object, filter's non-null property values.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtermetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding property
public List<T> findFiltered(T filter,
Map<String,? extends FilterMetadata> metadata,
int maxResults,
int page)
equals() or via a
specified FilterMetadata object, filter's non-null property values.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtermetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
public T findFilteredFirst(T filter)
filter, if existing.
findFilteredFirst in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filter
null if none found#findFiltered(T)
public T findFilteredFirst(T filter,
org.hibernate.criterion.Order... orders)
filter, if existing.
findFilteredFirst in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filterorders - the orders to apply with respect to entity class properties
null if none found#findFiltered(T, Order...)
public T findFilteredFirst(T filter,
List<? extends org.hibernate.criterion.Criterion> criteria)
filter and the additional input
criteria, if existing.
findFilteredFirst in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtercriteria - a list of additional Hibernate criteria
null if none found#findFiltered(T, List)public T load(K key)
load in interface HibernateDAO<T,K extends Serializable>key - the id of the entity instance to load
public T loadIfAvailable(K key)
loadIfAvailable in interface HibernateDAO<T,K extends Serializable>key - the id of the entity instance to load
public T get(K key)
get in interface HibernateDAO<T,K extends Serializable>key - the id of the entity instance to load
public K save(T obj)
save in interface HibernateDAO<T,K extends Serializable>obj - the entity instance to save
public void update(T obj)
update in interface HibernateDAO<T,K extends Serializable>obj - a transient instance containing updated statepublic void saveOrUpdate(T obj)
saveOrUpdate in interface HibernateDAO<T,K extends Serializable>obj - Objectpublic boolean delete(K key)
delete in interface HibernateDAO<T,K extends Serializable>key - key
public void refresh(T obj)
INSERT or
UPDATE statements
refresh in interface HibernateDAO<T,K extends Serializable>obj - the entity instance to refreshpublic void evict(T obj)
evict in interface HibernateDAO<T,K extends Serializable>obj - the entity instance to removepublic T merge(T obj)
cascade="merge".
merge in interface HibernateDAO<T,K extends Serializable>obj - a detached instance with state to be copied
@Deprecated
public List<T> findAll(org.hibernate.criterion.Order[] orders,
List<? extends org.hibernate.criterion.Criterion> criteria)
findAll in interface HibernateDAO<T,K extends Serializable>orders - desc or asccriteria - Additional Criterion conditions
public List<T> findFiltered(T filter,
org.hibernate.criterion.Order[] customOrder,
Map<String,? extends FilterMetadata> metadata,
int maxResults,
int page)
equals() or via a
specified FilterMetadata object, filter's non-null property values. The result list is
ordered according to the orders parameter.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtercustomOrder - the orders to apply with respect to entity class propertiesmetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
public List<T> findFiltered(T filter,
Map<String,? extends FilterMetadata> metadata,
int maxResults,
int page,
org.hibernate.criterion.Order... orders)
equals() or via a
specified FilterMetadata object, filter's non-null property values. The result list is
ordered according to the orders parameter.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtermetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
paginationorders - the orders to apply with respect to entity class properties
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)
equals() or via a
specified FilterMetadata object, filter's non-null property values, and the input
criteria.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtermetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
paginationcriteria - a list of additional Hibernate criteriaorders - the orders to apply with respect to entity class properties
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)
HibernateDAO.findFiltered(Object, Order[], Map, int, int, List)
findFilteredProperties in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filtermetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
paginationcriteria - a list of additional Hibernate criteriaproperties - the names of the properties to returnorders - the orders to apply with respect to entity class properties
@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)
equals() or via a
specified FilterMetadata object, filter's non-null property values, and the input
criteria.
findFiltered in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filterorders - the orders to apply with respect to entity class propertiesmetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
paginationcriteria - a list of additional Hibernate criteria
@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)
HibernateDAO.findFiltered(Object, Order[], Map, int, int, List)
findFilteredProperties in interface HibernateDAO<T,K extends Serializable>filter - an instance of this DAO's entity class to be used as filterorders - the orders to apply with respect to entity class propertiesmetadata - a map that matches names of entity class properties to FilterMetadata modifiers,
that will be used for comparing values of the corresponding propertymaxResults - the maximum number of results to be fetchedpage - 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
paginationcriteria - a list of additional Hibernate criteriaproperties - the names of the properties to return
public void setAopenabled(boolean aopenabled)
aopenabled - the aopenabled to setpublic void setReferenceClass(Class<T> referenceClass)
protected Class<T> getReferenceClass()
protected org.hibernate.criterion.Order[] getDefaultOrder()
Order object to be used for the default ordering of the collection.
protected List<?> findByNamedQuery(String name,
Serializable[] params,
Integer maxResults)
name - the name of a query defined externallyparams - the parameter arraymaxResults - max number of results
protected List<?> findByNamedQuery(String name,
Map<String,?> params,
Integer maxResults)
name - the name of a query defined externallyparams - the parameter MapmaxResults - max number of results
@Deprecated
protected List<?> getNamedQuery(String name,
Serializable[] params,
int maxResults)
findByNamedQuery method
name - the name of a query defined externallyparams - the parameter arraymaxResults - max number of results
@Deprecated
protected List<?> getNamedQuery(String name,
Map<String,?> params,
int maxResults)
findByNamedQuery method
name - the name of a query defined externallyparams - the parameter MapmaxResults - max number of results
protected void setParameterValue(org.hibernate.Query query,
String key,
Object value)
query - the Query to setkey - the key namevalue - the object to set as the parameterprotected Map<String,? extends FilterMetadata> getDefaultFilterMetadata()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||