|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.ifremer.allegro.CriteriaSearch
public class CriteriaSearch
Implements a generic search mechanism based on the Hibernate Criteria API. The
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.
The CriteriaSearch
is expected to be a general solution for a basic search with
parameters connected by logical and. This search does not provide grouping.
org.hibernate.Criteria
,
org.hibernate.criterion.Expression
Constructor Summary | |
---|---|
CriteriaSearch(org.hibernate.Session session,
java.lang.Class resultType)
Constructor for CriteriaSearch. |
Method Summary | |
---|---|
void |
addParameter(CriteriaSearchParameter parameter)
Adds a CriteriaSearchParameter to this search. |
void |
addParameter(java.lang.Object parameterValue,
java.lang.String parameterPattern)
Adds a CriteriaSearchParameter to this search. |
void |
addParameter(java.lang.String parameterValue,
java.lang.String parameterPattern)
Adds a CriteriaSearchParameter to this search. |
java.util.List |
executeAsList()
Executes a HibernateQuery using the currently defined
CriteriaSearchParameter s, and returns a java.util.List
containing the query results. |
java.util.Set |
executeAsSet()
Executes a HibernateQuery using the currently defined
CriteriaSearchParameter s, 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CriteriaSearch(org.hibernate.Session session, java.lang.Class resultType)
CriteriaSearch
with a default
CriteriaSearchConfiguration
.
session
- The Hibernate session.resultType
- The Class
of the result.Method Detail |
---|
protected org.hibernate.Criteria getRootCriteria()
public java.util.Set executeAsSet() throws org.hibernate.HibernateException
HibernateQuery
using the currently defined
CriteriaSearchParameter
s, and returns a java.util.Set
containing the query results.
org.hibernate.HibernateException
public java.util.List executeAsList() throws org.hibernate.HibernateException
HibernateQuery
using the currently defined
CriteriaSearchParameter
s, and returns a java.util.List
containing the query results.
org.hibernate.HibernateException
public void addParameter(java.lang.Object parameterValue, java.lang.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.HibernateException
public void addParameter(java.lang.String parameterValue, java.lang.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.HibernateException
public 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.HibernateException
public CriteriaSearchConfiguration getConfiguration()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |