/**
   * Extract named queries from class mapping and add them to JDO class descriptor.
   *
   * @param jdoNature JDO class descriptor to add the named queries to.
   * @param clsMap Class mapping to extract the named queries from.
   * @throws MappingException On duplicate query names.
   */
  private void extractAndAddNamedQueries(
      final ClassDescriptorJDONature jdoNature, final ClassMapping clsMap) throws MappingException {
    Enumeration namedQueriesEnum = clsMap.enumerateNamedQuery();
    while (namedQueriesEnum.hasMoreElements()) {
      NamedQuery query = (NamedQuery) namedQueriesEnum.nextElement();
      String queryName = query.getName();
      if (_queryNames.contains(queryName)) {
        throw new MappingException("Duplicate entry for named query with name " + queryName);
      }
      _queryNames.add(queryName);

      jdoNature.addNamedQuery(queryName, query.getQuery());
    }
  }