From cd1a8568e69d12cdacc6d42db9cdae8fb9f25223 Mon Sep 17 00:00:00 2001 From: Hannes Date: Sun, 21 Jun 2020 00:06:15 +0200 Subject: [PATCH] show only one entry per article suggestions fix #96 --- .../java/org/hso/ecommerce/repos/shop/ArticleRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java b/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java index 8af382a..d0a6ab1 100644 --- a/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java +++ b/prototype/src/main/java/org/hso/ecommerce/repos/shop/ArticleRepository.java @@ -29,7 +29,7 @@ public interface ArticleRepository extends JpaRepository { @Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a ORDER BY co.id DESC") List
getOrderedArticles(); - @Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a WHERE c.id = :customerId ORDER BY co.id DESC") + @Query("SELECT DISTINCT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a WHERE c.id = :customerId ORDER BY co.id DESC") List
getOrderedArticles(long customerId); /***