Friday, February 10, 2012

Restrictions.disjunction()


contacts = PTISessionFactory.getSession().createCriteria(Contact.class)
                    .add(Restrictions.eq("ownerKey", customerKey))
                    .add(Restrictions.eq("ownerType", "C"))
                    .add(Restrictions.eq("contactType", "P"))
                    .add(Restrictions.disjunction()
                    .add(Restrictions.ilike("name", searchString, MatchMode.ANYWHERE))
                    .add(Restrictions.ilike("title", searchString, MatchMode.ANYWHERE))
                    .add(Restrictions.ilike("email", searchString, MatchMode.ANYWHERE)))
                    .addOrder(Order.asc("name"))
                    .list();

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home