IT I 프로그래밍/자바 I 스프링 DB
[1] 스프링(Spring Tools 4) DB : DTO파일 만들기
^___^
2021. 10. 19. 15:18
[1] 스프링(Spring Tools 4) DB : DTO 파일 만들기
1. 스프링(Spring Tools 4) DB : DTO파일 만들기
프로젝트 오른쪽 마우스 > Class > 패키지명(com.hs.app) > class명 CrudDto.java
package com.hs.app;
public class CrudDto {
// 1-1 DB 필드 입력
private int idx;
private String name;
// 1-3 빈생성자 만들기(꼭 만들어야 함) : 편집창 오른쪽 마우스 > Source > Generate Getters and Setters
public CrudDto() {} // ctrl+Shift
// 1-4 값 넣는 생성자 만들기 : 편집창 오른쪽 마우스 > Source > Generate Constructor using Fields > 'super'는 삭제
public CrudDto(int idx, String name) {
this.idx = idx;
this.name = name;
}
// 1-2 게터&세터 만들기 : 편집창 오른쪽 마우스 > Source > Generate Getters and Setters
public int getIdx() {
return idx;
}
public void setIdx(int idx) {
this.idx = idx;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}