code: private Query getQuery(String jpaQuery, PersistenceDelegator persistenceDelegator, EntityMetadata m,
              KunderaQuery kunderaQuery, final KunderaMetadata kunderaMetadata) throws ClassNotFoundException,
              SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException,
              IllegalAccessException, InvocationTargetException
      {
          Query query;
  
          Class clazz = persistenceDelegator.getClient(m).getQueryImplementor();
  
          @SuppressWarnings("rawtypes")
          Constructor constructor = clazz.getConstructor(KunderaQuery.class, PersistenceDelegator.class,
                  KunderaMetadata.class);
          query = (Query) constructor.newInstance(kunderaQuery, persistenceDelegator, kunderaMetadata);
  
          return query;
      }
docs: Gets the query instance.
  
  @param jpaQuery
  the jpa query
  @param persistenceDelegator
  the persistence delegator
  @param persistenceUnits
  the persistence units
  @return the query
  @throws ClassNotFoundException
  the class not found exception
  @throws SecurityException
  the security exception
  @throws NoSuchMethodException
  the no such method exception
  @throws IllegalArgumentException
  the illegal argument exception
  @throws InstantiationException
  the instantiation exception
  @throws IllegalAccessException
  the illegal access exception
  @throws InvocationTargetException
  the invocation target exception