summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/PostTextPK.java20
1 files changed, 9 insertions, 11 deletions
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());
}
}