Package org.jrest4guice.dao.annotations

Examples of org.jrest4guice.dao.annotations.Retrieve


   * 获取查询方式的返回结果
   * @param parameters 参数
   * @return
   */
  private Object queryResult(Object[] parameters) {
    Retrieve retrieve = getAnnotation();
    Query query = getQuery();
    QueryParameter queryPara = new QueryParameter(parameters, method.getParameterAnnotations());
    QueryUtils.fittingQuery(query, queryPara);
    if (!retrieve.resultClass().equals(void.class) && !retrieve.nativeQuery())
      return toProjectionalObject(retrieve.resultClass(), query.getSingleResult());
    else
      return query.getSingleResult();
  }
View Full Code Here


  /**
   * 检查是否有查询设置,有返回<code>true</code>,没有返回<code>false</code>
   * @return
   */
  private boolean hasQuerySetting() {
    Retrieve retrieve = getAnnotation();
    if (StringUtils.isNotBlank(retrieve.query()))
      return true;
    if (StringUtils.isNotBlank(retrieve.namedQuery()))
      return true;
    return false;
  }
View Full Code Here

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

TOP

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

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.