Add Repository, Controller (User)
This commit is contained in:
@@ -7,7 +7,6 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "posts")
|
||||
@@ -18,8 +17,10 @@ import java.util.List;
|
||||
public class PostEntity extends BaseEntity<Long> {
|
||||
@Column
|
||||
private String title;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String contents;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.REFRESH, CascadeType.DETACH})
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserEntity user;
|
||||
@@ -27,3 +28,4 @@ public class PostEntity extends BaseEntity<Long> {
|
||||
@OneToMany(mappedBy = "post", fetch = FetchType.EAGER, cascade = {CascadeType.ALL}, orphanRemoval = true)
|
||||
private Collection<CommentEntity> comments;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user