/**
   * findMatchingObjects
   *
   * @param type a {@link java.lang.Class} object.
   * @param onmsCrit a {@link org.opennms.netmgt.model.OnmsCriteria} object.
   * @param <S> a S object.
   * @return a {@link java.util.List} object.
   */
  @SuppressWarnings("unchecked")
  public <S> List<S> findMatchingObjects(final Class<S> type, final OnmsCriteria onmsCrit) {
    onmsCrit.resultsOfType(type);

    final HibernateCallback<S> callback =
        new HibernateCallback<S>() {
          @Override
          public S doInHibernate(final Session session) throws HibernateException, SQLException {
            final Criteria attachedCrit =
                onmsCrit.getDetachedCriteria().getExecutableCriteria(session);
            if (onmsCrit.getFirstResult() != null)
              attachedCrit.setFirstResult(onmsCrit.getFirstResult());
            if (onmsCrit.getMaxResults() != null)
              attachedCrit.setMaxResults(onmsCrit.getMaxResults());
            return (S) attachedCrit.list();
          }
        };
    return getHibernateTemplate().executeFind(callback);
  }
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  public List<T> findMatching(final OnmsCriteria onmsCrit) throws DataAccessException {
    onmsCrit.resultsOfType(m_entityClass); // FIXME: why is this here?

    final HibernateCallback<List<T>> callback =
        new HibernateCallback<List<T>>() {
          @Override
          public List<T> doInHibernate(final Session session)
              throws HibernateException, SQLException {
            final Criteria attachedCrit =
                onmsCrit.getDetachedCriteria().getExecutableCriteria(session);
            if (onmsCrit.getFirstResult() != null)
              attachedCrit.setFirstResult(onmsCrit.getFirstResult());
            if (onmsCrit.getMaxResults() != null)
              attachedCrit.setMaxResults(onmsCrit.getMaxResults());
            return (List<T>) attachedCrit.list();
          }
        };
    return getHibernateTemplate().executeFind(callback);
  }