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

OO-3071: fix some queries with extra braces that the new version of hibernate doesn't like

parent 65d66ecd
No related branches found
No related tags found
No related merge requests found
...@@ -213,7 +213,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements Us ...@@ -213,7 +213,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements Us
public List<Subscriber> getSubscribers(IdentityRef identity, List<String> types) { public List<Subscriber> getSubscribers(IdentityRef identity, List<String> types) {
if(identity == null) return Collections.emptyList(); if(identity == null) return Collections.emptyList();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder(256);
sb.append("select sub from notisub as sub ") sb.append("select sub from notisub as sub ")
.append("inner join fetch sub.publisher as publisher ") .append("inner join fetch sub.publisher as publisher ")
.append("where sub.identity.key = :identityKey"); .append("where sub.identity.key = :identityKey");
...@@ -241,11 +241,10 @@ public class NotificationsManagerImpl extends NotificationsManager implements Us ...@@ -241,11 +241,10 @@ public class NotificationsManagerImpl extends NotificationsManager implements Us
public List<Subscriber> getSubscribers(IdentityRef identity, long resId) { public List<Subscriber> getSubscribers(IdentityRef identity, long resId) {
if(identity == null) return Collections.emptyList(); if(identity == null) return Collections.emptyList();
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder(256);
sb.append("select sub from notisub as sub ") sb.append("select sub from notisub as sub")
.append("inner join fetch sub.publisher as publisher ") .append(" inner join fetch sub.publisher as publisher")
.append("where sub.identity.key = :identityKey") .append(" where sub.identity.key = :identityKey and publisher.resId = :resId");
.append(" and publisher.resId = :resId)");
return dbInstance.getCurrentEntityManager() return dbInstance.getCurrentEntityManager()
.createQuery(sb.toString(), Subscriber.class) .createQuery(sb.toString(), Subscriber.class)
.setParameter("identityKey", identity.getKey()) .setParameter("identityKey", identity.getKey())
...@@ -262,7 +261,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements Us ...@@ -262,7 +261,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements Us
public List<Subscriber> getValidSubscribers(Identity identity) { public List<Subscriber> getValidSubscribers(Identity identity) {
if(identity == null) return Collections.emptyList(); if(identity == null) return Collections.emptyList();
StringBuilder q = new StringBuilder(); StringBuilder q = new StringBuilder(256);
q.append("select sub from notisub sub ") q.append("select sub from notisub sub ")
.append(" inner join fetch sub.publisher as pub ") .append(" inner join fetch sub.publisher as pub ")
.append(" where sub.identity.key=:anIdentityKey and pub.state=").append(PUB_STATE_OK); .append(" where sub.identity.key=:anIdentityKey and pub.state=").append(PUB_STATE_OK);
......
...@@ -2037,14 +2037,12 @@ public class RepositoryManager { ...@@ -2037,14 +2037,12 @@ public class RepositoryManager {
} }
public List<RepositoryEntryLight> getParticipantRepositoryEntry(IdentityRef identity, int maxResults, RepositoryEntryOrder... orderby) { public List<RepositoryEntryLight> getParticipantRepositoryEntry(IdentityRef identity, int maxResults, RepositoryEntryOrder... orderby) {
StringBuilder sb = new StringBuilder(200); StringBuilder sb = new StringBuilder(512);
sb.append("select v from repoentrylight as v ") sb.append("select v from repoentrylight as v ")
.append(" inner join fetch v.olatResource as res ") .append(" inner join fetch v.olatResource as res ")
.append(" where exists (select rel from repoentrytogroup as rel, bgroup as baseGroup, bgroupmember as membership ") .append(" where exists (select rel from repoentrytogroup as rel, bgroup as baseGroup, bgroupmember as membership")
.append(" where rel.entry=v and rel.group=baseGroup and membership.group=baseGroup and membership.identity.key=:identityKey ") .append(" where rel.entry=v and rel.group=baseGroup and membership.group=baseGroup and membership.identity.key=:identityKey")
.append(" and membership.role='").append(GroupRoles.participant.name()).append("')") .append(" and membership.role='").append(GroupRoles.participant.name()).append("')")
.append(" )")
.append(" )")
.append(" and (v.access>=3 or (v.access=").append(RepositoryEntry.ACC_OWNERS).append(" and v.membersOnly=true))"); .append(" and (v.access>=3 or (v.access=").append(RepositoryEntry.ACC_OWNERS).append(" and v.membersOnly=true))");
appendOrderBy(sb, "v", orderby); appendOrderBy(sb, "v", orderby);
...@@ -2058,14 +2056,12 @@ public class RepositoryManager { ...@@ -2058,14 +2056,12 @@ public class RepositoryManager {
} }
public List<RepositoryEntryLight> getTutorRepositoryEntry(IdentityRef identity, int maxResults, RepositoryEntryOrder... orderby) { public List<RepositoryEntryLight> getTutorRepositoryEntry(IdentityRef identity, int maxResults, RepositoryEntryOrder... orderby) {
StringBuilder sb = new StringBuilder(200); StringBuilder sb = new StringBuilder(512);
sb.append("select v from repoentrylight as v ") sb.append("select v from repoentrylight as v ")
.append(" inner join fetch v.olatResource as res ") .append(" inner join fetch v.olatResource as res ")
.append(" where exists (select rel from repoentrytogroup as rel, bgroup as baseGroup, bgroupmember as membership ") .append(" where exists (select rel from repoentrytogroup as rel, bgroup as baseGroup, bgroupmember as membership")
.append(" where rel.entry=v and rel.group=baseGroup and membership.group=baseGroup and membership.identity.key=:identityKey ") .append(" where rel.entry=v and rel.group=baseGroup and membership.group=baseGroup and membership.identity.key=:identityKey")
.append(" and membership.role='").append(GroupRoles.coach.name()).append("')") .append(" and membership.role='").append(GroupRoles.coach.name()).append("')")
.append(" )")
.append(" )")
.append(" and (v.access>=3 or (v.access=").append(RepositoryEntry.ACC_OWNERS).append(" and v.membersOnly=true))"); .append(" and (v.access>=3 or (v.access=").append(RepositoryEntry.ACC_OWNERS).append(" and v.membersOnly=true))");
appendOrderBy(sb, "v", orderby); appendOrderBy(sb, "v", orderby);
......
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