studyplan

spring boot 게시판 만들기 5.게시판 repository 기능 만들기 interface , implements , 자바에서 오라클에 데이터 넣기 , templete.update(sql,) , JdbcTemplate 본문

스프링

spring boot 게시판 만들기 5.게시판 repository 기능 만들기 interface , implements , 자바에서 오라클에 데이터 넣기 , templete.update(sql,) , JdbcTemplate

무한머니 2022. 7. 19. 09:58

repository  = 저장소 ! 

 

 

// 게시글 쓰기 기능
boolean save(Board board);
// 게시글 전체 조회
List<Board> findAll();
// 게시글 상세 조회
Board findOne(Long boardNo);
// 게시글 삭제
boolean remove(Long boardNo);
// 게시글 수정
boolean modify(Board board);
// 전체 게시물 수
int getTotalCount();

기본적인 기능 

게시글 쓰기 , 게시글 전체 조회 , 상세조회 , 게시글 삭제 , 게시글 수정 , 전체 게시물 수 ! 를 가진 보드인터페이스다 

 

저 기능들을 담은 

@Repository("bri")
@Log4j2
@RequiredArgsConstructor

 

 

 

는 ~ 다

 tbl_board

에 

"(board_no, writer, title, conte`nt) " +

이런 값을 

"VALUES (seq_tbl_board.nextval, ?, ?, ?)";

이렇게 넣는데 

그 물음표 값은 

return template.update(sql
        , board.getWriter()
        , board.getTitle()
        , board.getContent()
) == 1;

이렇게 넣는다 

Comments