Skip to content
Snippets Groups Projects
Commit f400306e authored by srosse's avatar srosse
Browse files

CL-220: fix dangerous fetch in mail manager which make maxResults unused

parent 4614c4d1
No related branches found
No related tags found
No related merge requests found
...@@ -472,12 +472,13 @@ public class MailManager extends BasicManager { ...@@ -472,12 +472,13 @@ public class MailManager extends BasicManager {
sb.append("select distinct(mail) from ").append(DBMailLightImpl.class.getName()).append(" mail") sb.append("select distinct(mail) from ").append(DBMailLightImpl.class.getName()).append(" mail")
.append(" inner join fetch mail.from fromRecipient") .append(" inner join fetch mail.from fromRecipient")
.append(" inner join fromRecipient.recipient fromRecipientIdentity") .append(" inner join fromRecipient.recipient fromRecipientIdentity")
.append(" inner join fetch mail.recipients recipient") .append(" inner join mail.recipients recipient")
.append(" inner join recipient.recipient recipientIdentity") .append(" inner join recipient.recipient recipientIdentity")
.append(" where fromRecipientIdentity.key=:fromKey and fromRecipient.deleted=false and recipientIdentity.key!=:fromKey") .append(" where fromRecipientIdentity.key=:fromKey and fromRecipient.deleted=false and recipientIdentity.key!=:fromKey")
.append(" order by mail.creationDate desc"); .append(" order by mail.creationDate desc");
TypedQuery<DBMailLight> query = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), DBMailLight.class) TypedQuery<DBMailLight> query = dbInstance.getCurrentEntityManager()
.createQuery(sb.toString(), DBMailLight.class)
.setParameter("fromKey", from.getKey()); .setParameter("fromKey", from.getKey());
if(maxResults > 0) { if(maxResults > 0) {
query.setMaxResults(maxResults); query.setMaxResults(maxResults);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment