class HibernateGenericDAO extends HibernatePersistentObjectDAO<Generic> implements GenericDAO {

	@Override
	public Generic findByAlternateKey(String type, String subtype, Long qualifier, long tenantId) {
		Generic generic = null;
		StringBuffer sb = new StringBuffer(" _entity.type = '" + SqlUtil.doubleQuotes(type) + "' and _entity.subtype='"
				+ SqlUtil.doubleQuotes(subtype) + "' ");
		sb.append(" and _entity.tenantId=" + tenantId);
		if (qualifier != null)
			sb.append(" and _entity.qualifier=" + qualifier);
		else
			sb.append(" and _entity.qualifier is null");
		try {
			Collection<Generic> coll = findByWhere(sb.toString(), null, null);
			if (coll.size() > 0)
				generic = coll.iterator().next();
		} catch (PersistenceException e) {
			log.error(e.getMessage(), e);
		}
		return generic;
	}

	public  HibernateGenericDAO();

}