예제 #1
0
 @Override
 public Response findByReview(final Integer id) {
   final QResponse response = QResponse.response;
   JPQLQuery query = jpqlQuery();
   query.from(response).where(response.review.id.eq(id));
   return query.singleResult(response);
 }
예제 #2
0
  @Test
  public void One_To_One() {
    QEmployee employee = QEmployee.employee;
    QUser user = QUser.user;

    JPQLQuery query = query();
    query.from(employee);
    query.innerJoin(employee.user, user);
    query.list(employee);
  }
예제 #3
0
  @Test
  @NoBatooJPA
  public void Enum_In() {
    QEmployee employee = QEmployee.employee;

    JPQLQuery query = query();
    query
        .from(employee)
        .where(employee.lastName.eq("Smith"), employee.jobFunctions.contains(JobFunction.CODER));
    assertEquals(1l, query.count());
  }
예제 #4
0
  @Override
  public ProductReview getById(Long id) {

    QProductReview qEntity = QProductReview.productReview;
    QProductReviewDescription qDescription = QProductReviewDescription.productReviewDescription;
    QProduct qProduct = QProduct.product;

    JPQLQuery query = new JPAQuery(getEntityManager());

    query
        .from(qEntity)
        .join(qEntity.customer)
        .fetch()
        .join(qEntity.product, qProduct)
        .fetch()
        .leftJoin(qProduct.merchantStore)
        .fetch()
        .leftJoin(qEntity.descriptions, qDescription)
        .fetch()
        .where(qEntity.id.eq(id));

    return query.uniqueResult(qEntity);
  }
예제 #5
0
  @Override
  public List<ProductReview> getByProduct(Product product) {

    QProductReview qEntity = QProductReview.productReview;
    QProductReviewDescription qDescription = QProductReviewDescription.productReviewDescription;
    QProduct qProduct = QProduct.product;

    JPQLQuery query = new JPAQuery(getEntityManager());

    query
        .from(qEntity)
        .join(qEntity.customer)
        .fetch()
        .join(qEntity.product, qProduct)
        .fetch()
        .leftJoin(qProduct.merchantStore)
        .fetch()
        .leftJoin(qEntity.descriptions, qDescription)
        .fetch()
        .where(qProduct.id.eq(product.getId()));

    return query.list(qEntity);
  }
예제 #6
0
  @Override
  public ProductPrice getById(Long id) {
    QProductPrice qEntity = QProductPrice.productPrice;
    QProductAvailability qAvailability = QProductAvailability.productAvailability;
    QProductPriceDescription qEntityDescription = QProductPriceDescription.productPriceDescription;
    QProduct qProduct = QProduct.product;

    JPQLQuery query = new JPAQuery(getEntityManager());

    query
        .from(qEntity)
        .innerJoin(qEntity.productAvailability, qAvailability)
        .fetch()
        .innerJoin(qAvailability.product, qProduct)
        .fetch()
        .leftJoin(qEntity.descriptions, qEntityDescription)
        .fetch()
        .innerJoin(qProduct.merchantStore)
        .fetch()
        .where(qEntity.id.eq(id));

    return query.uniqueResult(qEntity);
  }