Guest User

Untitled

a guest
Jan 21st, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Criteria criteria = session.createCriteria(User.class);
  2. criteria.add(
  3. Restrictions.and(
  4. Restrictions.ilike("firstName", firstName),
  5. Restrictions.ilike("lastName", lastName)
  6. )
  7. );
  8.  
  9. def userList = userCriteria.list{
  10. and{
  11. if(firstName) {
  12. like('firstName',firstName)
  13. }
  14. if(lastName) {
  15. like('lastName',lastName)
  16. }
  17. }
  18. }
Add Comment
Please, Sign In to add comment