class HibernateSessionDAO extends HibernatePersistentObjectDAO<Session> implements SessionDAO {

	@Override
	public int countSessions(Long tenantId, Integer status) {
		StringBuffer query = new StringBuffer(" 1=1 ");
		if (tenantId != null)
			query.append(" and _entity.tenantId = " + tenantId);
		if (status != null)
			query.append(" and _entity.status = " + status);

		try {
			List<Session> sessions = findByWhere(query.toString(), null, null);
			return sessions.size();
		} catch (PersistenceException e) {
			log.error(e.getMessage(), e);
			return 0;
		}
	}

	protected  HibernateSessionDAO();

}