반응형
SMALL

[1] 댓글기능
(1) 오라클 DB 테이블 생성
시퀀스 생성
create sequence seq_comments;
select * from user_sequences;
DB 테이블 생성
오라클은 comment가 예약어라서 적용시 오류가 난다 그래서 comments로 생성했다
create table tbl_comments(
cno number(10,0),
bno number(10,0) not null,
comments varchar2(1000) not null,
commenter varchar2(50) not null,
commentDate date default sysdate,
commentUpdate date default sysdate
);
PK : cno 설정
alter table tbl_comments add constraint pk_comments primary key (cno);
FK 외래키 : bno
tbl_board 참조
alter table tbl_comments add constraint fk_board_comments
foreign key(bno) references tbl_board(bno):

시퀀스 권한 부여
grant select,ALTER on seq_comment to book_ex;
댓글 작성
insert into tbl_comments(cno,bno,comments,commenter)
values (seq_comment.nextval, 202,'reply','writer123');

(2) commentsDTO 생성


(3) commentMapper 생성
CommentMapper.java , CommentMapper.xml 각각 생성


(4) mapper 연결 테스트


반응형
LIST
'🌈 프로젝트 > 웹 프로젝트' 카테고리의 다른 글
🌻 웹프로젝트_[15] 오라클_댓글 Rest 준비 (190) | 2024.01.06 |
---|---|
🌻 웹프로젝트_[14] 오라클_댓글 기능 CRUD (238) | 2023.12.31 |
🌻 웹프로젝트_[12] 오라클_검색기능 (166) | 2023.12.29 |
🌻 웹프로젝트_[11] 오라클_페이징 처리 (237) | 2023.12.24 |
🌻 웹프로젝트_[10] 오라클_페이지 네비게이션 (235) | 2023.12.22 |