From 366d8eb7448f2eeb253dfc76e724af5ec3137109 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 12 Jan 2020 16:46:36 +0100 Subject: Add fetch = FetchType.LAZY to all relationship declarations. Change-Id: I22435019234ed092ae07ffd8e61b212416b4dd0f --- src/main/java/eu/mulk/mulkcms2/entity/Article.java | 14 ++++++++------ src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java | 3 ++- .../java/eu/mulk/mulkcms2/entity/ArticleRevision.java | 9 +++++---- .../mulkcms2/entity/ArticleRevisionCharacteristic.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/Category.java | 5 +++-- src/main/java/eu/mulk/mulkcms2/entity/Comment.java | 5 +++-- .../java/eu/mulk/mulkcms2/entity/CommentRevision.java | 5 +++-- src/main/java/eu/mulk/mulkcms2/entity/Journal.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java | 5 +++-- .../eu/mulk/mulkcms2/entity/LegacyJournalComment.java | 3 ++- .../java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java | 7 ++++--- .../eu/mulk/mulkcms2/entity/LegacyJournalPingback.java | 3 ++- .../eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java | 3 ++- .../java/eu/mulk/mulkcms2/entity/LoginCertificate.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/OpenId.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/Password.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/User.java | 15 ++++++++------- src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java | 3 ++- src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java | 3 ++- 20 files changed, 61 insertions(+), 40 deletions(-) (limited to 'src/main/java/eu') diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Article.java b/src/main/java/eu/mulk/mulkcms2/entity/Article.java index abd6036..d06eb3f 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Article.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Article.java @@ -6,6 +6,7 @@ import java.util.Objects; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; @@ -13,6 +14,7 @@ import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; +import org.hibernate.annotations.Fetch; @Entity @Table(name = "articles", schema = "public", catalog = "mulkcms") @@ -53,7 +55,7 @@ public class Article extends PanacheEntityBase { return Objects.hash(id); } - @OneToMany(mappedBy = "article") + @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) public Collection getAliases() { return aliases; } @@ -62,7 +64,7 @@ public class Article extends PanacheEntityBase { this.aliases = aliases; } - @ManyToMany + @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "article_category_memberships", joinColumns = @JoinColumn(name = "article"), inverseJoinColumns = @JoinColumn(name = "category") @@ -75,7 +77,7 @@ public class Article extends PanacheEntityBase { this.categories = categories; } - @OneToMany(mappedBy = "article") + @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) public Collection getRevisions() { return revisions; } @@ -84,7 +86,7 @@ public class Article extends PanacheEntityBase { this.revisions = revisions; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "type", referencedColumnName = "id", nullable = false) public ArticleType getType() { return type; @@ -94,7 +96,7 @@ public class Article extends PanacheEntityBase { this.type = type; } - @OneToMany(mappedBy = "article") + @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) public Collection getComments() { return comments; } @@ -103,7 +105,7 @@ public class Article extends PanacheEntityBase { this.comments = comments; } - @OneToMany(mappedBy = "article") + @OneToMany(mappedBy = "article", fetch = FetchType.LAZY) public Collection getJournalEntries() { return journalEntries; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java index a7c4924..d41e28f 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleAlias.java @@ -4,6 +4,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -43,7 +44,7 @@ public class ArticleAlias extends PanacheEntityBase { return Objects.hash(alias); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) public Article getArticle() { return article; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java index 9235c4c..9ea1450 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevision.java @@ -8,6 +8,7 @@ import java.util.Set; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; @@ -126,7 +127,7 @@ public class ArticleRevision extends PanacheEntityBase { return Objects.hash(id, date, title, content, format, status, globalId); } - @OneToMany(mappedBy = "articleRevision") + @OneToMany(mappedBy = "articleRevision", fetch = FetchType.LAZY) public Collection getCharacteristics() { return characteristics; } @@ -136,7 +137,7 @@ public class ArticleRevision extends PanacheEntityBase { this.characteristics = characteristics; } - @ManyToMany + @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "article_revision_parenthood", joinColumns = @JoinColumn(name = "parent"), inverseJoinColumns = @JoinColumn(name = "child") @@ -158,7 +159,7 @@ public class ArticleRevision extends PanacheEntityBase { this.parents = parents; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) public Article getArticle() { return article; @@ -168,7 +169,7 @@ public class ArticleRevision extends PanacheEntityBase { this.article = article; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", referencedColumnName = "id") public User getAuthors() { return authors; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java index e619c1f..6dfc881 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleRevisionCharacteristic.java @@ -5,6 +5,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -61,7 +62,7 @@ public class ArticleRevisionCharacteristic extends PanacheEntityBase { return Objects.hash(characteristic, value); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "revision", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public ArticleRevision getArticleRevision() { return articleRevision; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java b/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java index e9b1b84..6f8d02d 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/ArticleType.java @@ -6,6 +6,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -68,7 +69,7 @@ public class ArticleType extends PanacheEntityBase { return Objects.hash(id, name, pageTemplate); } - @OneToMany(mappedBy = "type") + @OneToMany(mappedBy = "type", fetch = FetchType.LAZY) public Collection
getArticles() { return articles; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Category.java b/src/main/java/eu/mulk/mulkcms2/entity/Category.java index 177081c..20d91c2 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Category.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Category.java @@ -6,6 +6,7 @@ import java.util.Set; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; @@ -59,7 +60,7 @@ public class Category extends PanacheEntityBase { return Objects.hash(id, name); } - @ManyToMany + @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "category_inclusions", joinColumns = @JoinColumn(name = "category"), inverseJoinColumns = @JoinColumn(name = "supercategory") @@ -72,7 +73,7 @@ public class Category extends PanacheEntityBase { this.supercategories = supercategories; } - @ManyToMany(mappedBy = "supercategories") + @ManyToMany(mappedBy = "supercategories", fetch = FetchType.LAZY) public Set getSubcategories() { return subcategories; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Comment.java b/src/main/java/eu/mulk/mulkcms2/entity/Comment.java index 502c8b9..8e38b95 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Comment.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Comment.java @@ -6,6 +6,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -59,7 +60,7 @@ public class Comment extends PanacheEntityBase { return Objects.hash(id, globalId); } - @OneToMany(mappedBy = "comment") + @OneToMany(mappedBy = "comment", fetch = FetchType.LAZY) public Collection getRevisions() { return revisions; } @@ -68,7 +69,7 @@ public class Comment extends PanacheEntityBase { this.revisions = revisions; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) public Article getArticle() { return article; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java b/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java index a984b35..a700bd6 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/CommentRevision.java @@ -8,6 +8,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -138,7 +139,7 @@ public class CommentRevision extends PanacheEntityBase { .hash(id, date, content, format, status, articleRevision, submitterIp, submitterUserAgent); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "comment", referencedColumnName = "id", nullable = false) public Comment getComment() { return comment; @@ -148,7 +149,7 @@ public class CommentRevision extends PanacheEntityBase { this.comment = comment; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author", referencedColumnName = "id") public User getUser() { return user; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Journal.java b/src/main/java/eu/mulk/mulkcms2/entity/Journal.java index 471ec46..4ef3fa6 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Journal.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Journal.java @@ -6,6 +6,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -56,7 +57,7 @@ public class Journal extends PanacheEntityBase { return Objects.hash(id, pathPrefix); } - @OneToMany(mappedBy = "journal") + @OneToMany(mappedBy = "journal", fetch = FetchType.LAZY) public Collection getEntries() { return entries; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java index 86ea6ba..da04b8a 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/JournalEntry.java @@ -4,6 +4,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -58,7 +59,7 @@ public class JournalEntry extends PanacheEntityBase { return Objects.hash(journalId, index); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "journal", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public Journal getJournal() { return journal; @@ -68,7 +69,7 @@ public class JournalEntry extends PanacheEntityBase { this.journal = journal; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) public Article getArticle() { return article; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java index 8516b14..a1bfd95 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalComment.java @@ -5,6 +5,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -153,7 +154,7 @@ public class LegacyJournalComment extends PanacheEntityBase { .hash(id, uuid, date, body, author, email, website, spamP, submitterIp, submitterUserAgent); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) public LegacyJournalEntry getJournalEntry() { return journalEntry; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java index 6b7e21a..ce36c47 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalEntry.java @@ -6,6 +6,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -118,7 +119,7 @@ public class LegacyJournalEntry extends PanacheEntityBase { return Objects.hash(id, uuid, title, date, lastModification, body, type); } - @OneToMany(mappedBy = "journalEntry") + @OneToMany(mappedBy = "journalEntry", fetch = FetchType.LAZY) public Collection getComments() { return comments; } @@ -127,7 +128,7 @@ public class LegacyJournalEntry extends PanacheEntityBase { this.comments = comments; } - @OneToMany(mappedBy = "journalEntry") + @OneToMany(mappedBy = "journalEntry", fetch = FetchType.LAZY) public Collection getPingbacks() { return pingbacks; } @@ -136,7 +137,7 @@ public class LegacyJournalEntry extends PanacheEntityBase { this.pingbacks = pingbacks; } - @OneToMany(mappedBy = "journalEntry") + @OneToMany(mappedBy = "journalEntry", fetch = FetchType.LAZY) public Collection getTrackbacks() { return trackbacks; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java index ef35dec..9b683b7 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalPingback.java @@ -5,6 +5,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -116,7 +117,7 @@ public class LegacyJournalPingback extends PanacheEntityBase { return Objects.hash(id, uuid, date, url, spamP, submitterIp, submitterUserAgent); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) public LegacyJournalEntry getJournalEntry() { return journalEntry; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java index 6c46bf0..76bfd54 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LegacyJournalTrackback.java @@ -5,6 +5,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; @@ -154,7 +155,7 @@ public class LegacyJournalTrackback extends PanacheEntityBase { submitterUserAgent); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false) public LegacyJournalEntry getJournalEntry() { return journalEntry; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java index 61b7185..1095420 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/LoginCertificate.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -60,7 +61,7 @@ public class LoginCertificate extends PanacheEntityBase { return result; } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public User getUser() { return user; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java b/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java index 6060712..ee86773 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/OpenId.java @@ -4,6 +4,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -57,7 +58,7 @@ public class OpenId extends PanacheEntityBase { return Objects.hash(userId, openid); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public User getUser() { return user; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/Password.java b/src/main/java/eu/mulk/mulkcms2/entity/Password.java index 7a785b0..bf7d443 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/Password.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/Password.java @@ -4,6 +4,7 @@ import io.quarkus.hibernate.orm.panache.PanacheEntityBase; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -57,7 +58,7 @@ public class Password extends PanacheEntityBase { return Objects.hash(userId, password); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public User getUser() { return user; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/User.java b/src/main/java/eu/mulk/mulkcms2/entity/User.java index 1c9e425..ebe5048 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/User.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/User.java @@ -6,6 +6,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -98,7 +99,7 @@ public class User extends PanacheEntityBase { return Objects.hash(id, name, status, email, website); } - @OneToMany(mappedBy = "authors") + @OneToMany(mappedBy = "authors", fetch = FetchType.LAZY) public Collection getArticleRevisions() { return articleRevisions; } @@ -107,7 +108,7 @@ public class User extends PanacheEntityBase { this.articleRevisions = articleRevisions; } - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection getCommentRevisions() { return commentRevisions; } @@ -116,7 +117,7 @@ public class User extends PanacheEntityBase { this.commentRevisions = commentRevisions; } - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection getLoginCertificates() { return loginCertificates; } @@ -125,7 +126,7 @@ public class User extends PanacheEntityBase { this.loginCertificates = loginCertificates; } - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection getOpenids() { return openids; } @@ -134,7 +135,7 @@ public class User extends PanacheEntityBase { this.openids = openids; } - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection getPasswords() { return passwords; } @@ -143,7 +144,7 @@ public class User extends PanacheEntityBase { this.passwords = passwords; } - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection getUserPermissions() { return userPermissions; } @@ -152,7 +153,7 @@ public class User extends PanacheEntityBase { this.userPermissions = userPermissions; } - @OneToMany(mappedBy = "user") + @OneToMany(mappedBy = "user", fetch = FetchType.LAZY) public Collection getUserSettings() { return userSettings; } diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java b/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java index cde34e6..1395742 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserPermission.java @@ -5,6 +5,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -70,7 +71,7 @@ public class UserPermission extends PanacheEntityBase { return Objects.hash(userId, permission, status); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public User getUser() { return user; diff --git a/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java b/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java index 5459562..0d6bd05 100644 --- a/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java +++ b/src/main/java/eu/mulk/mulkcms2/entity/UserSetting.java @@ -5,6 +5,7 @@ import java.util.Objects; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; @@ -70,7 +71,7 @@ public class UserSetting extends PanacheEntityBase { return Objects.hash(userId, setting, value); } - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) public User getUser() { return user; -- cgit v1.2.3