summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-01-24 19:18:01 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2020-01-24 19:18:01 +0100
commit514273e539bbe580f142ce96d96972667b779b73 (patch)
tree31d8aaf42edf8bddac7fe76e28600b6de0e25f85 /src
parent9222efa007b8790852dc761d09367863bf56ddf3 (diff)
GET /wiki/{pageName}: Optimize HQL query.
Change-Id: I2e1852aa230fed5dc106629fb9b0aa0d85a8a0cf
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java
index 8f25254..ebed4e2 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java
@@ -44,7 +44,12 @@ public class WikiResource {
@Produces(TEXT_HTML)
public TemplateInstance getPage(@PathParam("pageName") String pageName) {
Optional<WikiPageRevision> maybePage =
- WikiPageRevision.find("title = ?1", Sort.by("date").descending(), pageName)
+ WikiPageRevision.find(
+ "from WikiPageRevision rev"
+ + " join fetch rev.author"
+ + " where rev.title = ?1",
+ Sort.by("date").descending(),
+ pageName)
.firstResultOptional();
if (maybePage.isEmpty()) {
throw new NotFoundException();