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