public class CriteriaSearch extends Object
CriteriaSearch allows adding parameters which function as where clause. The
parameters are analysed whether they should be considered or not. This depends both on the actual
value of the parameter and on the configuration.CriteriaSearch is expected to be a general solution for a basic search with
parameters connected by logical and. This search does not provide grouping.Criteria,
Expression| Constructor and Description |
|---|
CriteriaSearch(org.hibernate.Session session,
Class resultType)
Constructor for CriteriaSearch.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(CriteriaSearchParameter parameter)
Adds a
CriteriaSearchParameter to this search. |
void |
addParameter(Object parameterValue,
String parameterPattern)
Adds a
CriteriaSearchParameter to this search. |
void |
addParameter(String parameterValue,
String parameterPattern)
Adds a
CriteriaSearchParameter to this search. |
List |
executeAsList()
Executes a
HibernateQuery using the currently defined
CriteriaSearchParameters, and returns a java.util.List
containing the query results. |
Set |
executeAsSet()
Executes a
HibernateQuery using the currently defined
CriteriaSearchParameters, and returns a java.util.Set
containing the query results. |
CriteriaSearchConfiguration |
getConfiguration()
Returns the configuration of this search.
|
protected org.hibernate.Criteria |
getRootCriteria()
Exposes the root criteria to subclasses.
|
public CriteriaSearch(org.hibernate.Session session,
Class resultType)
CriteriaSearch with a default
CriteriaSearchConfiguration.session - The Hibernate session.resultType - The Class of the result.protected org.hibernate.Criteria getRootCriteria()
public Set executeAsSet() throws org.hibernate.HibernateException
HibernateQuery using the currently defined
CriteriaSearchParameters, and returns a java.util.Set
containing the query results.org.hibernate.HibernateExceptionpublic List executeAsList() throws org.hibernate.HibernateException
HibernateQuery using the currently defined
CriteriaSearchParameters, and returns a java.util.List
containing the query results.org.hibernate.HibernateExceptionpublic void addParameter(Object parameterValue, String parameterPattern) throws org.hibernate.HibernateException
CriteriaSearchParameter to this search. The parameter is connected to
the search by logical and. It is not considered if the value is null.
If the value is not null it is compared using the
CriteriaSearchParameter.EQUALS_COMPARATOR.parameterValue - The value of the parameter.parameterPattern - The pattern of the parameter (dot-seperated path e.g. person.address.street).org.hibernate.HibernateExceptionpublic void addParameter(String parameterValue, String parameterPattern) throws org.hibernate.HibernateException
CriteriaSearchParameter to this search. The parameter is connected to
the search by logical and. It is not considered if the value is null or
if the String empty. If the value is not null it is compared
using the CriteriaSearchParameter.LIKE_COMPARATOR.parameterValue - The value of the parameter.parameterPattern - The pattern of the parameter (dot-seperated path e.g. person.address.street).org.hibernate.HibernateExceptionpublic void addParameter(CriteriaSearchParameter parameter) throws org.hibernate.HibernateException
CriteriaSearchParameter to this search. The parameter is connected to
the search by logical and.parameter - The CriteriaSearchParameter to add.org.hibernate.HibernateExceptionpublic CriteriaSearchConfiguration getConfiguration()
Copyright © 2013. All Rights Reserved.