Package org.jrest4guice.dao.annotations

Examples of org.jrest4guice.dao.annotations.Find


  @Override
  public Object execute(Object[] parameters) {
    Query query = getQuery();
    QueryParameters queryPara = new QueryParameters(parameters, method.getParameterAnnotations());
    fittingQuery(query, queryPara);
    Find find = getAnnotation();
    if (!find.resultClass().equals(void.class))
      return toProjectionalList(find.resultClass(), query.list());
    return query.list();
  }
View Full Code Here


      query.setMaxResults(para.maxResults);
    }
  }

  private Query getQuery() {
    Find find = getAnnotation();
    if (StringUtils.isNotBlank(find.namedQuery()))
      return getSession().getNamedQuery(find.namedQuery());
    if (find.nativeQuery())
      return getSession().createSQLQuery(find.query());
    else
      return getSession().createQuery(find.query());
  }
View Full Code Here

  @Override
  public Object execute(Object[] parameters) {
    Query query = getQuery();
    QueryParameter queryPara = new QueryParameter(parameters, method.getParameterAnnotations());
    fittingQuery(query, queryPara);
    Find find = getAnnotation();
    if (!find.resultClass().equals(void.class) && !find.nativeQuery())
      return toProjectionalList(find.resultClass(), query.getResultList());
    return query.getResultList();
  }
View Full Code Here

      query.setMaxResults(para.getMaxResults());
    }
  }
 
  private Query getQuery() {
    Find find = getAnnotation();
    EntityManager em = getContext().getEntityManager();
    if (StringUtils.isNotBlank(find.namedQuery()))
      return em.createNamedQuery(find.namedQuery());
    if (find.nativeQuery()) {
      if (find.resultClass().equals(void.class))
        return em.createNativeQuery(find.query());
      else
        return em.createNativeQuery(find.query(), find.resultClass());
    } else
      return em.createQuery(find.query());
  }
View Full Code Here

TOP

Related Classes of org.jrest4guice.dao.annotations.Find

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.