Skip to content

Create default entities - eunseobb#16

Open
eunseobb wants to merge 4 commits intodevfrom
feat/#12-eunseobb
Open

Create default entities - eunseobb#16
eunseobb wants to merge 4 commits intodevfrom
feat/#12-eunseobb

Conversation

@eunseobb
Copy link
Collaborator

No description provided.

@eunseobb eunseobb linked an issue Aug 26, 2023 that may be closed by this pull request
@eunseobb eunseobb changed the title 엔티티 설계 Create default entity -eunseobb Aug 26, 2023
@eunseobb eunseobb changed the title Create default entity -eunseobb Create default entities-eunseobb Aug 26, 2023
@eunseobb eunseobb changed the title Create default entities-eunseobb Create default entities - eunseobb Aug 26, 2023
@eunseobb eunseobb requested a review from ckyeon September 2, 2023 09:42
public class MatchPost extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "matchPost_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column이름은 match_post_id가 더 적절한 것 같습니다!

Comment on lines +18 to +25
@Column(name = "title", nullable = false)
private String title;

@Column(name = "title", nullable = false)
private String introduce;

@Column(name = "title", nullable = false)
private String appeal;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모든 column의 이름이 title이네요!
수정 부탁드립니다~

Comment on lines +27 to +29
@Column
@Enumerated(EnumType.STRING)
private MatchPostStatus status;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아무런 설정도 필요 없으면 @Column 어노테이션은 지우셔도 될 것 같습니다!

Comment on lines +34 to +44
public MatchPost(Long id, String title, String introduce, String appeal, MatchPostStatus status) {
Preconditions.checkArgument(title != null, "title must be provided.");
Preconditions.checkArgument(introduce != null, "introduce must be provided.");
Preconditions.checkArgument(appeal != null, "appeal must be provided.");

this.id = id;
this.title = title;
this.introduce = introduce;
this.appeal = appeal;
this.status = status;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status는 기본값이 정해져있기 때문에 생성자를 private으로 바꾸고, 다른 생성자를 만들어 constructor chaining을 하시면 좋을 것 같습니다!

Comment on lines +15 to +20
@JoinColumn(name = "user1_id")
private Long user1Id;

@OneToOne
@JoinColumn(name = "user2_id")
private Long user2Id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

만약 연관관계 객체 자체가 아닌 id만을 저장할 때는 jpa의 기능을 이용할 필요가 없습니다~

Comment on lines +14 to +16
@OneToMany
@Column(name = "matchPost_id")
private Long matchPostId;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

연관관계를 객체 자체가 아닌 id만을 저장할 때는 jpa의 기능을 이용할 필요가 없습니다~

만약 객체를 매핑하고 싶으시다면 타입을 Long -> MatchPost로 변경하시고
@Column -> @JoinColumn으로 변경해주세요~

Comment on lines +18 to +20
@OneToOne
@JoinColumn(name = "user_id")
private Long userId;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

연관관계를 객체 자체가 아닌 id만을 저장할 때는 jpa의 기능을 이용할 필요가 없습니다~

Comment on lines +22 to +24
@Column
@Enumerated(EnumType.STRING)
private UserMatchPostRole role;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아무런 설정도 필요 없으시면 @Column 어노테이션은 지우셔도 될 것 같습니다!

Comment on lines +14 to +20
@OneToOne
@JoinColumn(name = "user_id")
private Long user;

@OneToMany
@JoinColumn(name = "tag_id")
private Long tagId;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

연관관계를 객체 자체가 아닌 id만을 저장할 때는 jpa의 기능을 이용할 필요가 없습니다~

Comment on lines +9 to +12
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "userTag_id")
private static Long id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프로퍼티가 static이네요! 수정 부탁드립니다~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Column의 이름은 user_tag_id가 더 적절한 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create default entities

2 participants