Java
JDBC-DTO
2024.10.25
DTO (Data Transfer Object)역할: Controller ↔ Service ↔ View 사이에서 데이터를 전달하는 용도로 사용되는 객체.특징: 로직이 없고 필드와 getter/setter만 있는 순수한 데이터 객체.장점: Entity를 직접 노출하지 않고, 필요한 필드만 전달해 보안성과 유연성 향상.//DTO : Data Transfer Object//VO : Value Object @Data@AllArgsConstructor@NoArgsConstructor@ToString@Builderpublic class EmpDTO { int employee_id; String first_name; String last_name; String email; String phone_number; Dat..
Java
JDBC-View
2024.10.25
public class EmpView { public static void display(List empList) { System.out.println("=====모든 직원 조회====="); for(EmpDTO emp:empList) { System.out.println(emp); } } public static void display(EmpDTO emp) { System.out.println("=====모든 직원 조회====="); System.out.println(emp==null? "직원x" : emp); } public static void display(String message){ System.out.println("[알림]" + message); }}
Java
JDBC-Service
2024.10.25
//사용자요청 --> Controller --> Service --> Dao --> DB//DB 관련 없는 업무로직은 Service 에서 수행public class EmpService { EmpDAO empDAO = new EmpDAO(); public List SelectAllService() { return empDAO.selectAll(); } public EmpDTO selectByIdService(int empid) { return empDAO.selectById(empid); } public int insertService(EmpDTO emp) { return empDAO.insert(emp); } public int updateService(EmpDTO emp) ..
Java
자바 상속
2024.10.04
public class Animal {  void sing() { System.out.println("부모..... 동물은 소리를 낸다.");  }  void fly() { System.out.println("부모........동물은 날수있다.");  }} public class Cat extends Animal{  public Cat(){  super(); System.out.println("2.Cat 생성됨"); }  void play() { System.out.println("고양이 혼자놀기"); }  @Override public void sing() { System.out.println("cat.....야옹 야옹~~~~~"); }  @Override public void fly() { Syste..
Java
자바 CRUD 메모리 저장 방식
2024.09.26
JAVA CRUD 기본 형식 private static void menu() {  System.out.println("-----------------------------------"); System.out.println("1.예금 | 2.출금 | 3.잔고| 4.종료"); System.out.println("-----------------------------------"); }       private static void call12() { Scanner sc = new Scanner(System.in); //flag 값 주어짐 while 탈출할때 용이함 boolean isStop = false; int total = 0; while (!isStop) {  menu();  System.out.prin..