package models;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "messages")
public class Message {
    @Id @GeneratedValue
    @Column(name = "message_id", nullable = false)
    private int messageId;

    @Column(name = "parent_id", nullable = false)
    private int parentId;

    @Column(name = "author_id", nullable = false)
    private int authorId;

    @Column(name = "timestamp")
    private Date date;

    @Column(name = "body")
    private String body;
    


    public int getMessage() {
        return messageId;
    }

    public int getConversation_id() {
        return messageId;
    }

    public int getAuthor_id() {
        return authorId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }
}

@@ -219,32 +219,75 @@
 essageId;%0A%0A    @
+ManyToOne(fetch = FetchType.LAZY)%0A    @Join
 Column(name = %22p
@@ -331,28 +331,29 @@
 ate 
-int
+Person
  parent
-Id
 ;%0A%0A    @
 Colu
@@ -340,32 +340,75 @@
 n parent;%0A%0A    @
+ManyToOne(fetch = FetchType.LAZY)%0A    @Join
 Column(name = %22a
@@ -452,22 +452,61 @@
 ate 
-int
+Person
  author
-Id
 ;%0A
+%0A    @Temporal(TemporalType.TIMESTAMP)
 %0A   
@@ -755,72 +755,8 @@
  %7D%0A%0A
-    public int getAuthor_id() %7B%0A        return authorId;%0A    %7D%0A%0A
     
@@ -1005,11 +1005,153 @@
 y;%0A    %7D
+%0A%0A    public void setParent(Person parent) %7B%0A        this.parent = parent;%0A    %7D%0A%0A    public Person getAuthor() %7B%0A        return author;%0A    %7D
 %0A%7D%0A

Add in Message ManyToOne Relation