summaryrefslogtreecommitdiff
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2023-08-06 21:23:48 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2023-08-06 21:23:48 +0200
commit2b3aff0382643f8c58d183769818ec62acd498d8 (patch)
treeb4dc562636c654f60a67dd29d61ca76925fc847b /src/main/java/eu
parent2fa30295863c83e7cdf160164b52ace9c22775ec (diff)
PostTextPK: Rely on basic columns only.
This seems to make Hibernate happier and less confused. Change-Id: I15709c54b7eddd1cc65f651738f673bf02331174
Diffstat (limited to 'src/main/java/eu')
-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());
}
}