-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArticle.java
37 lines (33 loc) · 1020 Bytes
/
Article.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.gdsc.blog.article.entity;
import com.gdsc.blog.base.entity.Base;
import com.gdsc.blog.comment.entity.Comment;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
@Entity
@NoArgsConstructor
@AllArgsConstructor //생성자 자동 생성
@Getter
@Setter
@SuperBuilder
@Table(name = "articles")
public class Article extends Base {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; //id
@Column(length = 200)
private String title; //제목
@OneToMany(mappedBy = "article", cascade = CascadeType.REMOVE)
private List<Comment> comments;
}