Skip to content

오단비 1주차 과제 #5

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 5 commits into
base: main
Choose a base branch
from
Open

Conversation

danbi1102
Copy link

군 관련 데이터베이스 테이블

  1. 군인 정보 (군번/이름/부대/보직 별 column 구분)
스크린샷 2024-09-30 오전 1 35 40
  1. 군인별 개인정보 (군번/출생년도/생일/전화번호 column별 구분)
스크린샷 2024-09-30 오전 1 41 42

@danbi1102 danbi1102 marked this pull request as draft September 29, 2024 16:51
@danbi1102 danbi1102 marked this pull request as ready for review September 29, 2024 16:53
@danbi1102 danbi1102 changed the title [오단비] 1주차 과제 오단비 1주차 과제 Sep 29, 2024
Comment on lines +20 to 31
@Column(name = "군번") // 컬럼명을 지정한다.
private int id;

// @Column(name = "description")이 생략된 경우 필드명이 컬럼명이 된다.
@Column(name = "이름")
private String name;

@Column(name="부대")
private String militaryUnit;

@Column(name = "보직")
private String description;

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 +93 to +95
Assertions.assertThat(result1).isNull();
Assertions.assertThat(result2).isNotNull();
Assertions.assertThat(result3.getName()).isEqualTo("노승현");
Copy link
Member

Choose a reason for hiding this comment

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

굿굿굿입니다.
깔끔하게 잘 해내신 것 같습니다! 👍

package doit.jpastudy2.repository;

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

Copy link
Member

@jjunhub jjunhub Oct 2, 2024

Choose a reason for hiding this comment

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

여기 부분 이렇게 작성하셔도 동작은 하는데, 보통은 <Entity Class 이름, 그 클래스의 PK 타입>으로 작성하는 편입니다.
jpa단에서 자동으로 int <-> Long 변환을 수행하지만, 처음부터 올바르게 적어주시는게 좋을 것 같습니다~

Suggested change
public interface ArmyRepository extends JpaRepository<Army, int> {

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