public List<User> findByName(String search) {
   return userDAO.findByCriteria(Restrictions.ilike("name", search, MatchMode.ANYWHERE));
 }
 public User findByEmail(String email) {
   List<User> result = userDAO.findByCriteria(Restrictions.eq("email", email));
   if (result.isEmpty()) return null;
   return result.get(0);
 }
 public User findByLogin(String login) {
   List<User> result = userDAO.findByCriteria(Restrictions.like("login", login));
   if (result.isEmpty()) return null;
   return result.get(0);
 }
 public User findById(Long id) {
   return userDAO.findById(id);
 }
 public void delete(User user) {
   userDAO.delete(user);
 }
 public List<User> listAll() {
   return userDAO.listAll();
 }
 private void save(User user) {
   userDAO.save(user);
 }
 public int size() {
   return userDAO.listAll().size();
 }