try {
return userDao.saveUser(user);
} catch (DataIntegrityViolationException e) {
//e.printStackTrace();
log.warn(e.getMessage());
throw new UserExistsException("User '" + user.getUsername() + "' already exists!");
} catch (JpaSystemException e) { // needed for JPA
//e.printStackTrace();
log.warn(e.getMessage());
throw new UserExistsException("User '" + user.getUsername() + "' already exists!");
}catch (Exception e) {
log.warn(e.getMessage());
throw new UserExistsException("User '" + user.getUsername() + "' present problems to save!");
}
}