summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--build.gradle3
-rw-r--r--gradle.properties1
-rw-r--r--pom.xml6
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java13
5 files changed, 18 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 0d13c27..2b156fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ nb-configuration.xml
# Gradle
.gradle/
build/
+src/main/generated
# Shell
.envrc
diff --git a/build.gradle b/build.gradle
index f2ee661..423604f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -77,6 +77,8 @@ dependencies {
implementation "com.vladsch.flexmark:flexmark-all"
implementation "org.jsoup:jsoup"
+ annotationProcessor "org.hibernate:hibernate-jpamodelgen"
+
constraints {
implementation "com.vladmihalcea:hibernate-types-52:${hibernateTypesVersion}"
implementation "org.mapstruct:mapstruct:${mapstructVersion}"
@@ -88,6 +90,7 @@ dependencies {
implementation "com.vladsch.flexmark:flexmark-all:${flexmarkVersion}"
implementation "org.jsoup:jsoup:${jsoupVersion}"
implementation "com.rometools:rome:${romeVersion}"
+ annotationProcessor "org.hibernate:hibernate-jpamodelgen:${hibernateVersion}"
}
}
diff --git a/gradle.properties b/gradle.properties
index 65efece..7104428 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -19,6 +19,7 @@ useLatestVersionsPluginVersion = 0.2.13
findbugsJsr305Version = 3.0.2
flexmarkVersion = 0.60.2
hibernateTypesVersion = 2.9.3
+hibernateVersion = 5.4.12.Final
jakartaJaccVersion = 1.6.1
jnaVersion = 5.5.0
jose4jVersion = 0.7.0
diff --git a/pom.xml b/pom.xml
index 9943ec4..f67cba9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -213,6 +213,12 @@
<artifactId>hibernate-types-52</artifactId>
</dependency>
+ <!-- Hibernate -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jpamodelgen</artifactId>
+ </dependency>
+
<!-- Jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java
index 53b7ddc..ad75c4c 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarks/BookmarkResource.java
@@ -13,6 +13,7 @@ import com.rometools.rome.io.FeedException;
import com.rometools.rome.io.WireFeedOutput;
import eu.mulk.mulkcms2.benki.accesscontrol.Role;
import eu.mulk.mulkcms2.benki.users.User;
+import eu.mulk.mulkcms2.benki.users.User_;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateExtension;
import io.quarkus.qute.TemplateInstance;
@@ -269,9 +270,9 @@ public class BookmarkResource {
var root = query.from(Bookmark.class);
bm = root;
query.select(root);
- root.fetch("owner", JoinType.LEFT);
+ root.fetch(Bookmark_.owner, JoinType.LEFT);
- var target = root.join("targets");
+ var target = root.join(Bookmark_.targets);
query.where(cb.equal(target, Role.getWorld()));
} else {
var userName = identity.getPrincipal().getName();
@@ -279,14 +280,14 @@ public class BookmarkResource {
var root = query.from(User.class);
query.where(cb.equal(root, user));
- bm = root.join("visibleBookmarks");
- bm.fetch("owner", JoinType.LEFT);
+ bm = root.join(User_.visibleBookmarks);
+ bm.fetch(Bookmark_.owner, JoinType.LEFT);
}
- query.orderBy(cb.desc(bm.get("date")));
+ query.orderBy(cb.desc(bm.get(Bookmark_.date)));
if (owner != null) {
- query.where(cb.equal(bm.get("owner"), owner));
+ query.where(cb.equal(bm.get(Bookmark_.owner), owner));
}
var q = entityManager.createQuery(query);