Skip to content

김현민 1주차 과제 #12

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mineehyun
Copy link

image

사실 M:N이라 학생 - 과목 - 성적으로 쪼개야 할 것 같은데 일단 대충 만들었읍니다
EntityManagerFactory 써서 뭐 하려다가 잘 안됐는데 그것에 대해서는... 더 고민해 보는 것으로...

Comment on lines +12 to +13
@Getter
public class Grades {
Copy link
Member

Choose a reason for hiding this comment

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

자동으로 PK 값 생성하도록 설정해주신 것 좋습니다!


import org.springframework.data.jpa.repository.JpaRepository;

public interface GradesRepository extends JpaRepository {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public interface GradesRepository extends JpaRepository {
public interface GradesRepository extends JpaRepository<Grades, Long> {

JpaRepository를 사용하실 떄는 제네릭 부분에 <Entity 클래스 명, PK의 타입> 형태로 작성해주셔야합니다!

Comment on lines +15 to +16
@Id
private int studentId;
Copy link
Member

Choose a reason for hiding this comment

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

학생 학번이라 의도적으로 @GeneratedValue를 사용하지 않고, 직접 PK를 작성하도록 구현한 디테일 너무 좋습니다!

Copy link
Member

@jjunhub jjunhub left a comment

Choose a reason for hiding this comment

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

Student 엔티티 관련해서 의도적으로 자동 값을 PK로 설정하지 않은 점 인상 깊었습니다!
추가적으로 해당 엔티티에 대해서 정상적으로 동작하는 지 테스트 코드도 함께되면 더 좋을 것 같습니다. 수고하셧습니다~

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