@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); }
@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); }