From 3725e9473d853345073ecd0769810a23a0c542c7 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sat, 18 Oct 2014 22:37:56 +0200 Subject: [PATCH] =?UTF-8?q?Optimalizov=C3=A1no=20na=C4=8D=C3=ADt=C3=A1n?= =?UTF-8?q?=C3=AD=20po=C5=BEadavk=C5=AF=20z=20datab=C3=A1ze.=20Polo=C5=BEk?= =?UTF-8?q?y=20po=C5=BEadavk=C5=AF=20se=20na=C4=8D=C3=ADtaj=C3=AD=20jako?= =?UTF-8?q?=20lazy.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/info/bukova/isspst/data/Requirement.java | 2 +- .../services/requirement/RequirementService.java | 2 ++ .../requirement/RequirementServiceImpl.java | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/info/bukova/isspst/data/Requirement.java b/src/main/java/info/bukova/isspst/data/Requirement.java index 36edec15..661cfed7 100644 --- a/src/main/java/info/bukova/isspst/data/Requirement.java +++ b/src/main/java/info/bukova/isspst/data/Requirement.java @@ -16,7 +16,7 @@ import javax.persistence.Table; @Table(name = "REQUIREMENT") public class Requirement extends RequirementBase { - @OneToMany(fetch = FetchType.EAGER, mappedBy = "requirement", cascade = CascadeType.ALL, orphanRemoval = true) + @OneToMany(fetch = FetchType.LAZY, mappedBy = "requirement", cascade = CascadeType.ALL, orphanRemoval = true) private List items; @Column(name = "DELIVERYDATE") diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java index 61c91e6e..bb15c84d 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementService.java @@ -9,6 +9,8 @@ import java.util.List; public interface RequirementService extends RequirementBaseService { public void loadGroups(Requirement req); + + public void loadItems(Requirement req); public BigDecimal calcTotalFromItem(RequirementItem item); diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java index 542e375f..1a0df9cd 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -14,6 +14,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; +import org.hibernate.Hibernate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -135,6 +136,19 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl