-
Notifications
You must be signed in to change notification settings - Fork 14
오단비 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
base: main
Are you sure you want to change the base?
오단비 1주차 과제 #5
Conversation
@Column(name = "군번") // 컬럼명을 지정한다. | ||
private int id; | ||
|
||
// @Column(name = "description")이 생략된 경우 필드명이 컬럼명이 된다. | ||
@Column(name = "이름") | ||
private String name; | ||
|
||
@Column(name="부대") | ||
private String militaryUnit; | ||
|
||
@Column(name = "보직") | ||
private String description; | ||
|
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.
주제가 재밌네요ㅎㅎ..
Column명을 한국어로 작성하여도 동작은 정상적으로 하지만, 보통은 영어로 적는 편이 관례입니다.
참고하시면 될 것 같아요!
Assertions.assertThat(result1).isNull(); | ||
Assertions.assertThat(result2).isNotNull(); | ||
Assertions.assertThat(result3.getName()).isEqualTo("노승현"); |
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.
굿굿굿입니다.
깔끔하게 잘 해내신 것 같습니다! 👍
package doit.jpastudy2.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
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.
여기 부분 이렇게 작성하셔도 동작은 하는데, 보통은 <Entity Class 이름, 그 클래스의 PK 타입>으로 작성하는 편입니다.
jpa단에서 자동으로 int <-> Long 변환을 수행하지만, 처음부터 올바르게 적어주시는게 좋을 것 같습니다~
public interface ArmyRepository extends JpaRepository<Army, int> { |
군 관련 데이터베이스 테이블