diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-24 11:55:26 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-24 11:58:28 +0100 |
commit | aa754805d7a8353aa9b1fa6b9f3850606bde800e (patch) | |
tree | 97a4d321e92902586e1c79c0805b5fa82a3f2a72 /src/main/java/eu | |
parent | f9c742762bc08db7c3518e7d44cf7382b353d560 (diff) |
Set all fetch types to LAZY.
Change-Id: I0b0c96fe177260ece2a68381c71c4959c3a82dcb
Diffstat (limited to 'src/main/java/eu')
21 files changed, 66 insertions, 46 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java index 679c25d..c55686e 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/PageKey.java @@ -5,6 +5,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -24,7 +25,7 @@ public class PageKey extends PanacheEntityBase { @Column(name = "key", nullable = false, precision = 0) public BigInteger key; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java index 090fb92..563a2f8 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/Role.java @@ -8,6 +8,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -23,21 +24,21 @@ public class Role extends PanacheEntityBase { @Column(name = "name", nullable = true, length = -1) public String name; - @OneToMany(mappedBy = "target") + @OneToMany(mappedBy = "target", fetch = FetchType.LAZY) public Collection<PostTarget> targetedPosts; - @OneToMany(mappedBy = "superrole") + @OneToMany(mappedBy = "superrole", fetch = FetchType.LAZY) public Collection<RoleSubrole> subroles; - @OneToMany(mappedBy = "subrole") + @OneToMany(mappedBy = "subrole", fetch = FetchType.LAZY) public Collection<RoleSubrole> superroles; - @OneToMany(mappedBy = "target") + @OneToMany(mappedBy = "target", fetch = FetchType.LAZY) public Collection<UserDefaultTarget> usersUsedByAsDefaultTarget; - @OneToMany(mappedBy = "role") + @OneToMany(mappedBy = "role", fetch = FetchType.LAZY) public Collection<UserRole> users; - @OneToMany(mappedBy = "ownedRole") + @OneToMany(mappedBy = "ownedRole", fetch = FetchType.LAZY) public Collection<User> owningUsers; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java index 5e7b237..10c64ea 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/accesscontrol/RoleSubrole.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.accesscontrol; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -22,11 +23,11 @@ public class RoleSubrole extends PanacheEntityBase { @Column(name = "subrole", nullable = false) public int subroleId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "superrole", referencedColumnName = "id", nullable = false) public Role superrole; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "subrole", referencedColumnName = "id", nullable = false) public Role subrole; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java index 121e340..363783d 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/Bookmark.java @@ -4,6 +4,7 @@ import eu.mulk.mulkcms2.benki.generic.Post; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -20,6 +21,6 @@ public class Bookmark extends Post { @Column(name = "description", nullable = true, length = -1) public String description; - @OneToMany(mappedBy = "bookmark") + @OneToMany(mappedBy = "bookmark", fetch = FetchType.LAZY) public Collection<BookmarkTag> tags; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java index cca5478..10e6785 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/bookmarx/BookmarkTag.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.bookmarx; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -22,7 +23,7 @@ public class BookmarkTag extends PanacheEntityBase { @Column(name = "tag", nullable = false, length = -1) public String tag; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "bookmark", referencedColumnName = "id", nullable = false) public Bookmark bookmark; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java index bfa02d2..6839f99 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/Post.java @@ -28,7 +28,7 @@ public abstract class Post extends PanacheEntityBase { @Column(name = "date", nullable = true) public OffsetDateTime date; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "owner", referencedColumnName = "id") public User owner; diff --git a/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java index 3a3f6b2..cc406d7 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/generic/PostTarget.java @@ -4,6 +4,7 @@ import eu.mulk.mulkcms2.benki.accesscontrol.Role; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -23,7 +24,7 @@ public class PostTarget extends PanacheEntityBase { @Column(name = "target", nullable = false) public int targetId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) public Role target; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java index 626f263..d124c04 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatMessage.java @@ -4,6 +4,7 @@ import eu.mulk.mulkcms2.benki.generic.Post; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -17,6 +18,6 @@ public class LazychatMessage extends Post { @Column(name = "format", nullable = false, length = -1) public String format; - @OneToMany(mappedBy = "referrer") + @OneToMany(mappedBy = "referrer", fetch = FetchType.LAZY) public Collection<LazychatReference> references; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java index d1e8910..2abbaf5 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/lafargue/LazychatReference.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.lafargue; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -22,11 +23,11 @@ public class LazychatReference extends PanacheEntityBase { @Column(name = "referee", nullable = false) public int refereeId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "referrer", referencedColumnName = "id", nullable = false) public LazychatMessage referrer; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "referee", referencedColumnName = "id", nullable = false) public LazychatMessage referee; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java b/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java index 925584b..52997c8 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/Openids.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -14,7 +15,7 @@ public class Openids extends PanacheEntityBase { @Column(name = "openid", nullable = false, length = -1) public String openid; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java index 6e3db81..85bda62 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/RsaKey.java @@ -5,6 +5,7 @@ import java.math.BigInteger; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.OneToMany; @@ -23,6 +24,6 @@ public class RsaKey extends PanacheEntityBase { @Column(name = "exponent", nullable = false, precision = 0) public BigInteger exponent; - @OneToMany(mappedBy = "rsaKey") + @OneToMany(mappedBy = "rsaKey", fetch = FetchType.LAZY) public Collection<UserRsaKey> users; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/User.java b/src/main/java/eu/mulk/mulkcms2/benki/users/User.java index 11c01fb..a090690 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/User.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/User.java @@ -10,6 +10,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToMany; @@ -43,49 +44,49 @@ public class User extends PanacheEntityBase { @Column(name = "status", nullable = true, length = -1) public String status; - @OneToMany(mappedBy = "owner") + @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY) public Collection<Bookmark> bookmarks; - @OneToMany(mappedBy = "owner") + @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY) public Collection<LazychatMessage> lazychatMessages; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<Openids> openids; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<PageKey> pageKeys; - @OneToMany(mappedBy = "owner") + @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY) public Collection<Post> posts; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<UserDefaultTarget> defaultTargets; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<UserEmailAddress> emailAddresses; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<UserJid> jids; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<UserNickname> nicknames; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<UserRole> roles; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<UserRsaKey> rsaKeys; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) public Role ownedRole; - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection<WebId> webids; - @OneToMany(mappedBy = "author") + @OneToMany(mappedBy = "author", fetch = FetchType.LAZY) public Collection<WikiPageRevision> wikiPageRevisions; - @ManyToMany(mappedBy = "visibleTo") + @ManyToMany(mappedBy = "visibleTo", fetch = FetchType.LAZY) public Collection<Post> visiblePosts; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java index ffa5ef7..16807aa 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserDefaultTarget.java @@ -4,6 +4,7 @@ import eu.mulk.mulkcms2.benki.accesscontrol.Role; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -23,11 +24,11 @@ public class UserDefaultTarget extends PanacheEntityBase { @Column(name = "target", nullable = false) public int targetId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "target", referencedColumnName = "id", nullable = false) public Role target; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java index 9706407..21148b8 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserEmailAddress.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -16,7 +17,7 @@ public class UserEmailAddress extends PanacheEntityBase { @Column(name = "email", nullable = false, length = -1) public String email; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java index 1c17ca8..b2100a9 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserJid.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -22,7 +23,7 @@ public class UserJid extends PanacheEntityBase { @Column(name = "jid", nullable = false, length = -1) public String jid; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java index b664cb9..c31c8a1 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserNickname.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -16,7 +17,7 @@ public class UserNickname extends PanacheEntityBase { @Column(name = "nickname", nullable = false, length = -1) public String nickname; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java index d4c10bd..7d48b64 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRole.java @@ -4,6 +4,7 @@ import eu.mulk.mulkcms2.benki.accesscontrol.Role; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -23,11 +24,11 @@ public class UserRole extends PanacheEntityBase { @Column(name = "role", nullable = false) public int roleId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "role", referencedColumnName = "id", nullable = false) public Role role; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java index 33552e5..806c1b8 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/UserRsaKey.java @@ -4,6 +4,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.math.BigInteger; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -28,11 +29,11 @@ public class UserRsaKey extends PanacheEntityBase { @Column(name = "exponent", nullable = false, precision = 0) public BigInteger exponent; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumns({ @JoinColumn( name = "modulus", diff --git a/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java b/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java index 0a30ff1..246a448 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/users/WebId.java @@ -3,6 +3,7 @@ package eu.mulk.mulkcms2.benki.users; import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -16,7 +17,7 @@ public class WebId extends PanacheEntityBase { @Column(name = "webid", nullable = false, length = -1) public String webid; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false) public User user; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java index e2e5b13..754b633 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPage.java @@ -4,6 +4,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -16,6 +17,6 @@ public class WikiPage extends PanacheEntityBase { @Column(name = "id", nullable = false) public int id; - @OneToMany(mappedBy = "page") + @OneToMany(mappedBy = "page", fetch = FetchType.LAZY) public Collection<WikiPageRevision> revisions; } diff --git a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java index aa7dd4d..de92150 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/wiki/WikiPageRevision.java @@ -5,6 +5,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.time.OffsetDateTime; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -30,11 +31,11 @@ public class WikiPageRevision extends PanacheEntityBase { @Column(name = "format", nullable = true, length = -1) public String format; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "page", referencedColumnName = "id", nullable = false) public WikiPage page; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", referencedColumnName = "id") public User author; } |