From b54dbca358a7b554738b6e4f47692f5d867a1c25 Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Tue, 16 Jul 2013 12:37:06 +0200
Subject: [PATCH] OO-662: add fetch join in "Inbox" and in Evidence of
 achievement to speed up login

---
 src/main/java/org/olat/core/util/mail/manager/MailManager.java   | 1 +
 .../org/olat/course/assessment/EfficiencyStatementManager.java   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/main/java/org/olat/core/util/mail/manager/MailManager.java b/src/main/java/org/olat/core/util/mail/manager/MailManager.java
index 9e195653e21..5726dbac304 100644
--- a/src/main/java/org/olat/core/util/mail/manager/MailManager.java
+++ b/src/main/java/org/olat/core/util/mail/manager/MailManager.java
@@ -414,6 +414,7 @@ public class MailManager extends BasicManager {
 		StringBuilder sb = new StringBuilder();
 		String fetchOption = (fetchRecipients != null && fetchRecipients.booleanValue()) ? "fetch" : "";
 		sb.append("select mail from ").append(DBMailImpl.class.getName()).append(" mail")
+		  .append(" inner join fetch ").append(" mail.from fromRecipient")
 			.append(" inner join ").append(fetchOption).append(" mail.recipients recipient")
 			.append(" inner join ").append(fetchOption).append(" recipient.recipient recipientIdentity")
 			.append(" where recipientIdentity.key=:recipientKey and recipient.deleted=false");
diff --git a/src/main/java/org/olat/course/assessment/EfficiencyStatementManager.java b/src/main/java/org/olat/course/assessment/EfficiencyStatementManager.java
index 218195961c4..e93ce494f35 100644
--- a/src/main/java/org/olat/course/assessment/EfficiencyStatementManager.java
+++ b/src/main/java/org/olat/course/assessment/EfficiencyStatementManager.java
@@ -444,6 +444,7 @@ public class EfficiencyStatementManager extends BasicManager implements UserData
 		try {
 			StringBuilder sb = new StringBuilder();
 			sb.append("select statement from ").append(UserEfficiencyStatementLight.class.getName()).append(" as statement ")
+				.append(" left join fetch statement.resource resource")
 			  .append(" where statement.identity.key=:identityKey");
 
 			DBQuery query = dbInstance.createQuery(sb.toString());
-- 
GitLab