public class Example extends Object implements Criterion
List results = session.createCriteria(Parent.class) .add( Example.create(parent).ignoreCase() ) .createCriteria("child") .add( Example.create( parent.getChild() ) ) .list();"Examples" may be mixed and matched with "Expressions" in the same Criteria.
Criteria
,
Serialized FormModifier and Type | Class and Description |
---|---|
static interface |
Example.PropertySelector
A strategy for choosing property values for inclusion in the query
criteria
|
Modifier | Constructor and Description |
---|---|
protected |
Example(Object entity,
Example.PropertySelector selector) |
Modifier and Type | Method and Description |
---|---|
protected void |
addComponentTypedValues(String path,
Object component,
CompositeType type,
List list,
Criteria criteria,
CriteriaQuery criteriaQuery) |
protected void |
addPropertyTypedValue(Object value,
Type type,
List list) |
protected void |
appendComponentCondition(String path,
Object component,
CompositeType type,
Criteria criteria,
CriteriaQuery criteriaQuery,
StringBuilder buf) |
protected void |
appendPropertyCondition(String propertyName,
Object propertyValue,
Criteria criteria,
CriteriaQuery cq,
StringBuilder buf) |
static Example |
create(Object entity)
Create a new instance, which includes all non-null properties
by default
|
Example |
enableLike()
Use the "like" operator for all string-valued properties
|
Example |
enableLike(MatchMode matchMode)
Use the "like" operator for all string-valued properties
|
Example |
excludeNone()
Don't exclude null or zero-valued properties
|
Example |
excludeProperty(String name)
Exclude a particular named property
|
Example |
excludeZeroes()
Exclude zero-valued properties
|
TypedValue[] |
getTypedValues(Criteria criteria,
CriteriaQuery criteriaQuery)
Return typed values for all parameters in the rendered SQL fragment
|
Example |
ignoreCase()
Ignore case for all string-valued properties
|
Example |
setEscapeCharacter(Character escapeCharacter)
Set escape character for "like" clause
|
Example |
setPropertySelector(Example.PropertySelector selector)
Set the property selector
|
String |
toSqlString(Criteria criteria,
CriteriaQuery criteriaQuery)
Render the SQL fragment
|
String |
toString() |
protected Example(Object entity, Example.PropertySelector selector)
public Example setEscapeCharacter(Character escapeCharacter)
public Example setPropertySelector(Example.PropertySelector selector)
public Example excludeZeroes()
public Example excludeNone()
public Example enableLike(MatchMode matchMode)
public Example enableLike()
public Example ignoreCase()
public static Example create(Object entity)
entity
- public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException
Criterion
toSqlString
in interface Criterion
criteria
- The local criteriacriteriaQuery
- The overal criteria queryHibernateException
- Problem during rendering.public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException
Criterion
getTypedValues
in interface Criterion
criteria
- The local criteriacriteriaQuery
- The overal criteria queryHibernateException
- Problem determining types.protected void addComponentTypedValues(String path, Object component, CompositeType type, List list, Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException
HibernateException
protected void appendPropertyCondition(String propertyName, Object propertyValue, Criteria criteria, CriteriaQuery cq, StringBuilder buf) throws HibernateException
HibernateException
protected void appendComponentCondition(String path, Object component, CompositeType type, Criteria criteria, CriteriaQuery criteriaQuery, StringBuilder buf) throws HibernateException
HibernateException
Copyright © 2018 JBoss by Red Hat. All rights reserved.