예제 #1
0
  protected <E> DefaultTupleQueryInfoBean<E, E> createQueryInfoBean(Class<E> entityClass) {
    QueryInfoResultConverter<Tuple, E> resultConverter =
        new DefaultTupleToPojoQueryInfoResultConverter<>(entityClass);

    DefaultTupleQueryInfoBeanContext<E, E> context = new DefaultTupleQueryInfoBeanContext<E, E>();

    context.setEntityContextRegistry(entityContextRegistry);
    context.setEntityManager(entityManager);
    context.setResultConverter(resultConverter);
    context.setRootEntityClass(entityClass);

    DefaultTupleQueryInfoBean<E, E> result = new DefaultTupleQueryInfoBean<>();
    result.setBeanContext(context);

    return result;
  }
예제 #2
0
 public <E> PaginatedResult<E> queryForPaginatedResult(Class<E> entityClass, QueryInfo queryInfo)
     throws QueryInfoException {
   DefaultTupleQueryInfoBean<E, E> bean = createQueryInfoBean(entityClass);
   return bean.queryForPaginatedResult(queryInfo);
 }
예제 #3
0
 public <E> E queryForOne(Class<E> entityClass, QueryInfo queryInfo) throws QueryInfoException {
   DefaultTupleQueryInfoBean<E, E> bean = createQueryInfoBean(entityClass);
   return bean.queryForOne(queryInfo);
 }