PostTextPK: Rely on basic columns only.
This seems to make Hibernate happier and less confused.
Change-Id: I15709c54b7eddd1cc65f651738f673bf02331174
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 @@
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 @@
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());
}
}