#Comments / Replies Single Table
10 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @eternal estuary! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I want to keep things relatively simple so how should I handle this if my goal is something like this:
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
I am retroactively trying to implement these replies into my application. This is what my comment entity looks like as of now:
package com.skilldistillery.lorehunter.entities;
import java.time.LocalDateTime;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Comment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String content;
@CreationTimestamp
@Column(name = "created_at")
private LocalDateTime createdAt;
private String status;
@UpdateTimestamp
@Column(name = "last_edited")
private LocalDateTime lastEdited;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@JsonIgnore
@ManyToOne
@JoinColumn(name = "post_id")
private Post post;
private Boolean enabled;
@Column(name = "parent_id")
private int parentId;
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
Bump
Yeah this looks correct. Only thing is that you don't need to explicitly list your join column if it follows standard naming conventions