code: Query createQuery(String jpaQuery, final String persistenceUnit)
      {
          Client client = getClient(persistenceUnit);
          EntityMetadata metadata = null;
          try
          {
              metadata = KunderaMetadataManager.getMetamodel(kunderaMetadata, client.getPersistenceUnit())
                      .getEntityMetadataMap().values().iterator().next();
          }
          catch (Exception e)
          {
              log.info("Entity metadata is null. Proceeding as Scalar Query.");
          }
  
          Query query = new QueryResolver().getQueryImplementation(jpaQuery, getClient(persistenceUnit)
                  .getQueryImplementor(), this, metadata, persistenceUnit);
          return query;
      }
docs: Creates the query.
  
  @param jpaQuery
  the jpa query
  @return the query