class HibernateUserDAO extends HibernatePersistentObjectDAO<User> implements UserDAO {

	@Override
	public Set<User> findByGroup(long groupId) {
		List<Long> docIds = new ArrayList<Long>();
		try {
			docIds = queryForList("select ld_userid from ld_usergroup where ld_groupid=" + groupId, Long.class);
		} catch (PersistenceException e) {
			log.error(e.getMessage(), e);
		}
		Set<User> set = new HashSet<User>();
		if (!docIds.isEmpty()) {
			String query = "_entity.id in (" + StringUtil.arrayToString(docIds.toArray(new Long[0]), ",") + ")";

			try {
				List<User> users = findByWhere(query, null, null, null);
				for (User user : users) {
					if (user.getDeleted() == 0 && !set.contains(user))
						set.add(user);
				}
			} catch (PersistenceException e) {
				log.error(e.getMessage(), e);
			}
		}
		return set;
	}

	private  HibernateUserDAO();

}