From 514273e539bbe580f142ce96d96972667b779b73 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Fri, 24 Jan 2020 19:18:01 +0100 Subject: GET /wiki/{pageName}: Optimize HQL query. Change-Id: I2e1852aa230fed5dc106629fb9b0aa0d85a8a0cf --- src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiResource.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/eu') 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 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(); -- cgit v1.2.3