From 2b3aff0382643f8c58d183769818ec62acd498d8 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 6 Aug 2023 21:23:48 +0200 Subject: PostTextPK: Rely on basic columns only. This seems to make Hibernate happier and less confused. Change-Id: I15709c54b7eddd1cc65f651738f673bf02331174 --- .../eu/mulk/mulkcms2/benki/posts/PostTextPK.java | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostTextPK.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostTextPK.java index 42f0d88..b057ac5 100644 --- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostTextPK.java +++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostTextPK.java @@ -3,29 +3,27 @@ package eu.mulk.mulkcms2.benki.posts; import jakarta.persistence.Column; import jakarta.persistence.FetchType; import jakarta.persistence.Id; -import jakarta.persistence.IdClass; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import java.io.Serializable; import java.util.Objects; -@IdClass(PostTextPK.class) public class PostTextPK implements Serializable { - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "post", referencedColumnName = "id", nullable = false) - public Post post; + @Id + @Column(name = "post", nullable = false) + private int postId; @Id @Column(name = "language", nullable = false, length = -1) private String language; - public Post getPost() { - return post; + public int getPostId() { + return postId; } - public void setPost(Post post) { - this.post = post; + public void setPostId(int postId) { + this.postId = postId; } public String getLanguage() { @@ -45,11 +43,11 @@ public class PostTextPK implements Serializable { return false; } PostTextPK that = (PostTextPK) o; - return Objects.equals(getPost(), that.getPost()) && getLanguage().equals(that.getLanguage()); + return Objects.equals(getPostId(), that.getPostId()) && getLanguage().equals(that.getLanguage()); } @Override public int hashCode() { - return Objects.hash(getPost(), getLanguage()); + return Objects.hash(getPostId(), getLanguage()); } } -- cgit v1.2.3