All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dream.models.Comment Maven / Gradle / Ivy

package com.dream.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.springframework.data.annotation.CreatedDate;

import javax.persistence.*;
import java.time.LocalDateTime;

@Entity
@Table(name = "comment")
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class Comment {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false, unique = true)
    private Long id;

    @Lob
    @Column(name = "comment_description", nullable = false)
    private String commentDescription;

    @CreatedDate
    @Column(name = "created_at", nullable = false)
    private LocalDateTime createdAt;
    
    @Column(name = "likes_no")
    private int likesNo;

    @Column(name = "dislikes_no")
    private int dislikesNo;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "dream_id", nullable = false)
    @OnDelete(action = OnDeleteAction.CASCADE)
    @JsonIgnore
    private Dream dream;

    @Column(name = "approved", nullable = false)
    private boolean approved;

    @Column(name = "parent_id")
    private Long parentId;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy