Skip to content

Conversation

@AJKHJ
Copy link

@AJKHJ AJKHJ commented Oct 2, 2024

스크린샷 2024-10-02 오후 7 13 35

수업 출석 관련 Table을 만들어봤습니다.

Comment on lines +14 to +18
@Id
@GeneratedValue(strategy = GenerationType.AUTO)

@Column(name = "n주차")
private int id;
Copy link
Member

Choose a reason for hiding this comment

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

우선 자동으로 할당해주신 점 좋습니다!
n주차라고 작성해주신 것 보니, 아마 1주차에 해당하는 출석들을 모아서 설정하시려는 것 같은데 맞을까요?
맞다면 요 로직보다는 다음과 같이 작성해주시는 편이 좋을 것 같습니다

Suggested change
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "n주차")
private int id;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "attendant_id")
private int id;
@Column(name = "attendant_week_number")
private int weekNumber;

pk에는 의미가 없는 인공적인 값을 넣어주시는 것이 DB 구조 상 로직 작성하기에 편하실 것 같습니다! 참고하시면 될 것 같아요

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants