/**
   * Extract named native 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 native queries from.
   * @throws MappingException On duplicate query names.
   */
  private void extractAndAddNamedNativeQueries(
      final ClassDescriptorJDONature jdoNature, final ClassMapping clsMap) throws MappingException {
    Enumeration<? extends NamedNativeQuery> namedNativeQueriesEnum =
        clsMap.enumerateNamedNativeQuery();
    while (namedNativeQueriesEnum.hasMoreElements()) {
      NamedNativeQuery query = namedNativeQueriesEnum.nextElement();
      String queryName = query.getName();
      if (_queryNames.contains(queryName)) {
        throw new MappingException("Duplicate entry for named query with name " + queryName);
      }
      _queryNames.add(queryName);

      jdoNature.addNamedNativeQuery(queryName, query);
    }
  }