Certainly you can just keep adding in criteria queries like crazy. That's the beauty of the Hibernate Critieria API.
Code:
public static void main(String args[]) {
Session session = HibernateUtil.beginTransaction();
Criterion c1 = Restrictions.gt("id", (long)2);
Criterion c2 = Restrictions.lt("id", (long)8);
Criterion c3 = Restrictions.isNotNull("emailAddress");
User user = new User();
user.setEmailAddress(".com");
Example c4 = Example.create(user);
c4.enableLike(MatchMode.END);
c4.ignoreCase();
Criteria criteria = session.createCriteria(User.class);
criteria.add(c1);
criteria.add(c2);
criteria.add(c3);
criteria.add(c4);
List results = criteria.list();
HibernateUtil.commitTransaction();
for (int i = 0; i<results.size(); i++) {
System.out.println(results.get(i).toString());
}
}
The code above uses a disjunction, which provides an OR type of query=. Without using the disjunction, you'll default to the and query.
Here's a friendly little tutorial on how to use the Hibernate Criteria API, along with some Hibernte code snippets and Hibernate examples:
http://www.hibernatemadeeasy.com/HiberBookWeb/learn.jsp?tutorial=09howtousethecriteriaapi