diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java index 356461c..654db5f 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/Post.java @@ -126,12 +126,14 @@ public abstract class Post extends PanacheEntityBase { var root = query.from(User.class); conditions.add(cb.equal(root, user)); - if (entityClass.isAssignableFrom(Bookmark.class)) { + if (entityClass.isAssignableFrom(Post.class)) { + post = (From<?, T>) root.join(User_.visiblePosts); + } else if (entityClass.isAssignableFrom(Bookmark.class)) { post = (From<?, T>) root.join(User_.visibleBookmarks); } else if (entityClass.isAssignableFrom(LazychatMessage.class)) { post = (From<?, T>) root.join(User_.visibleLazychatMessages); } else { - post = (From<?, T>) root.join(User_.visiblePosts); + throw new IllegalArgumentException(); } } |