Save This Page
Home » hibernate-distribution-3.3.1.GA-dist » org.hibernate » criterion » [javadoc | source]
org.hibernate.criterion
public class: Example [javadoc | source]
java.lang.Object
   org.hibernate.criterion.Example

All Implemented Interfaces:
    Criterion

Support for query by example.
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.
Nested Class Summary:
public static interface  Example.PropertySelector  A strategy for choosing property values for inclusion in the query criteria 
static final class  Example.AllPropertySelector   
static final class  Example.NotNullPropertySelector   
static final class  Example.NotNullOrZeroPropertySelector   
Constructor:
 protected Example(Object entity,
    Example.PropertySelector selector) 
Method from org.hibernate.criterion.Example Summary:
addComponentTypedValues,   addPropertyTypedValue,   appendComponentCondition,   appendPropertyCondition,   create,   enableLike,   enableLike,   excludeNone,   excludeProperty,   excludeZeroes,   getTypedValues,   ignoreCase,   setEscapeCharacter,   setPropertySelector,   toSqlString,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.hibernate.criterion.Example Detail:
 protected  void addComponentTypedValues(String path,
    Object component,
    AbstractComponentType type,
    List list,
    Criteria criteria,
    CriteriaQuery criteriaQuery) throws HibernateException 
 protected  void addPropertyTypedValue(Object value,
    Type type,
    List list) 
 protected  void appendComponentCondition(String path,
    Object component,
    AbstractComponentType type,
    Criteria criteria,
    CriteriaQuery criteriaQuery,
    StringBuffer buf) throws HibernateException 
 protected  void appendPropertyCondition(String propertyName,
    Object propertyValue,
    Criteria criteria,
    CriteriaQuery cq,
    StringBuffer buf) throws HibernateException 
 public static Example create(Object entity) 
    Create a new instance, which includes all non-null properties by default
 public Example enableLike() 
    Use the "like" operator for all string-valued properties
 public Example enableLike(MatchMode matchMode) 
    Use the "like" operator for all string-valued properties
 public Example excludeNone() 
    Don't exclude null or zero-valued properties
 public Example excludeProperty(String name) 
    Exclude a particular named property
 public Example excludeZeroes() 
    Exclude zero-valued properties
 public TypedValue[] getTypedValues(Criteria criteria,
    CriteriaQuery criteriaQuery) throws HibernateException 
 public Example ignoreCase() 
    Ignore case for all string-valued properties
 public Example setEscapeCharacter(Character escapeCharacter) 
    Set escape character for "like" clause
 public Example setPropertySelector(Example.PropertySelector selector) 
    Set the property selector
 public String toSqlString(Criteria criteria,
    CriteriaQuery criteriaQuery) throws HibernateException 
 public String toString()