class HibernateAttributeOptionDAO extends HibernatePersistentObjectDAO<AttributeOption> implements AttributeOptionDAO {

	@Override
	public void deleteOrphaned(long setId, Collection<String> currentAttributes) {
		try {
			if (currentAttributes == null || currentAttributes.isEmpty() || !checkStoringAspect())
				return;
			StringBuffer buf = new StringBuffer();
			for (String name : currentAttributes) {
				if (buf.length() == 0)
					buf.append("('");
				else
					buf.append(",'");
				buf.append(SqlUtil.doubleQuotes(name));
				buf.append("'");
			}
			buf.append(")");

			List<AttributeOption> options = findByQuery(
					"from AttributeOption _opt where _opt.setId = ?1 and _opt.attribute not in " + buf.toString(),
					new Object[] { setId }, null);

			for (AttributeOption option : options)
				del(option, PersistentObject.DELETED_CODE_DEFAULT);
		} catch (Throwable e) {
			log.error(e.getMessage(), e);
		}
	}

	public  HibernateAttributeOptionDAO();

}