-
Notifications
You must be signed in to change notification settings - Fork 14
강수빈 1주차 과제 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
강수빈 1주차 과제 #11
Conversation
왜 반말이야? |
ㅋㅋ 귀찮잖아~ |
@Column(name = "prof_id") // 컬럼명을 지정한다. | ||
private Long id; | ||
|
||
// @Column(name = "type")이 생략된 경우 필드명이 컬럼명이 된다. snake_case로 변환된다. | ||
@Column(name = "prof_name") | ||
private String name; | ||
|
||
// @Column(name = "description")이 생략된 경우 필드명이 컬럼명이 된다. | ||
@Column(name = "prof_email") | ||
private String email; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋습니다!
진짜 예전에는 MySQL 용량 차지한다고 DB Column 이름을 줄여서 사용하곤 했는데, 요즘은 그냥 이름 길게길게 사용하는게 일반적이라고 하더라구요. 물론 이건 어디나 프로젝트 바이 프로젝트이니, 참고만 하시면 될 것 같습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엥 이거 왜 줄이 그어지지
일부로 그은거 아닙니다..
Professor findByEmail(String email); | ||
Professor findByName(String name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
규칙 지켜서 잘 작성해주셨습니다!
Professor findByProfId(Long id);
위의 쿼리 메소드와 비교해서, 이 메소드에 대해서 항상 유일하게 Professor 개체가 1개만 나오는가?를 고려해보신 뒤에
다음과 같은 사항을 고민해보시는 것도 좋을 것 같습니다.
- 어떻게 이를 변경하면 좋을지
- 언제가 항상 1개이고, 언제가 여러 개일수 있는 경우인지
전반적으로 깔끔하게 잘 작성해주셨습니다!! |
테이블 설명
교수님(M)들과 수강과목(N)들의 관계
교수 테이블
교수_id <- PK
과목 테이블
과목_id <- PK
교수 <-> 과목
교수_id, 과목_id <- FK(M:N)
아쉬운 점
학점도 다른 테이블로 빼야할 것 같지만??? 귀ㅣ찮습니다
아직... 교수 테이블밖에 안 만들었ㄴㄴ데 힘 좀 써보고 다시 돌아와볼ㄹ게ㅕ