Package org.hibernate.ejb

Examples of org.hibernate.ejb.HibernateQuery


    if(sorts != null && sorts.length > 0){
      queryString += " order by " + StringUtil.join(sorts);
    }
    logger.debug("Find[{}]", queryString);
    Query query = entityManager.createQuery(queryString);
    HibernateQuery hQuery = (HibernateQuery) query;
    String [] paramNames = hQuery.getHibernateQuery().getNamedParameters();
    if(paramNames != null && paramNames.length >0){
      logger.debug("Parameter List:");
      int i=1;
      for(String key: paramNames){
        logger.debug("{}) [{}] : {}", new Object[]{i++, key, params.get(key)});
View Full Code Here


    List<T> list = findByQueryExNative(queryString, params, sorts, start, pageSize);
    p.setItems(list);
    String countQueryString = getCountQueryStringForHql(queryString);
    Query query = entityManager.createQuery(countQueryString);
    Map<String,Object> paramsNew = new HashMap<String, Object>();
    HibernateQuery hQuery = (HibernateQuery) query;
    String [] paramNames = hQuery.getHibernateQuery().getNamedParameters();
    if(paramNames != null && paramNames.length >0){
      for(String key: paramNames){
        paramsNew.put(key, params.get(key));
      }
    }
View Full Code Here

        PersistenceProvider.fromEntityManager(entityManager));
    PartTreeJpaQuery jpaQuery = new PartTreeJpaQuery(queryMethod, entityManager);

    Query query = jpaQuery.createQuery(new Object[] { "Matthews", new PageRequest(0, 1) });

    HibernateQuery hibernateQuery = getValue(query, "h.target." + (isHibernate43() ? "jpqlQuery" : "val$jpaqlQuery"));
    assertThat(hibernateQuery.getHibernateQuery().getQueryString(), endsWith("firstname=:param0"));

    query = jpaQuery.createQuery(new Object[] { null, new PageRequest(0, 1) });

    hibernateQuery = getValue(query, "h.target." + (isHibernate43() ? "jpqlQuery" : "val$jpaqlQuery"));
    assertThat(hibernateQuery.getHibernateQuery().getQueryString(), endsWith("firstname is null"));
  }
View Full Code Here

    }

    @Override
    public <T> CloseableIterator<T> iterate(Query query, FactoryExpression<?> projection) {
        if (query instanceof HibernateQuery) {
            HibernateQuery hQuery = (HibernateQuery)query;
            ScrollableResults results = hQuery.getHibernateQuery().scroll(ScrollMode.FORWARD_ONLY);
            CloseableIterator<T> iterator = new ScrollableResultsIterator<T>(results);
            if (projection != null) {
                iterator = new TransformingIterator<T>(iterator, projection);
            }
            return iterator;
View Full Code Here

TOP

Related Classes of org.hibernate.ejb.HibernateQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.