Backend/Java

ArrayList에 DTO 객체 저장

olli2 2021. 11. 30. 11:21

db5 복사해서 다음과 같이 변경

  • DAO 클래스의 selectStudent() 메서드에서 한 행씩 출력 
  • → 모든 행을 ArrayList에 담아서
  • StudentSelect 클래스의 select() 메서드에게 반환
  • select() 메서드에서 출력

 

db6

  • 모든 클래스 복사해서 수정
  • DAO 클래스의 selectStudent() 메서드의 반환형을 ArrayList<StudentDTO> 변경
  • StudentSelect 클래스의 select()
  • StudentDTO 클래스에 toString() 추가 : StringBuilder 사용