
#1.스프링부트,Spring Data JPA게시판(구현기술및기능)-오라클연동게시판소스
질문하실 내용이 있으시면 Q/A에 올려주시면 성의껏 답변 드리겠습니다.
감사합니다.
구현 기술 및 기능
<!--[if !supportLists]-->n
<!--[endif]-->Spring Boot, MVC, Spring Data
JPA, AngularJS 기반으로 게시판을 만들어 보자.
<!--[if !supportLists]-->n
<!--[endif]-->JPA로 게시판을 만든다는 것은 맞지
않을 수도 있지만 기능과 사용방법을 익힌다는 관점에서 간단히 만들어 보자. 본예제는 오라클 DB를 기준으로 작성되었으며 MySQL(MariaDB) 예제는 다음
URL에서 참조하면 된다.
<!--[if !supportLists]-->n
<!--[endif]-->구현기술
Spring Boot, Spring WEB MVC,
RestController
Spring Data
JPA(Hibernate)
기본 JpaRepository
Query Method
Oracle DataBase(DB는 편한걸로 사용가능)
UI : JSP, BootStrap, AngularJS,
JSON
Logging: DriverSpy
<!--[if !supportLists]-->n
<!--[endif]-->기본기능
글리스트 보기, 글입력,
글읽기, 글수정, 글삭제, 답변글작성
<!--[if !supportLists]-->n
<!--[endif]-->테이블 및 시퀀스
DDL
<!--[if !supportLists]-->ü
<!--[endif]-->테이블 및 시퀀스는 엔티티 정의해서 자동 생성시킬 예정이니 DB쪽에 생성할 필요없다. 구조만 확인하자.
<!--[if !supportLists]-->ü
<!--[endif]-->Board 테이블의 PK(ID칼럼, Primary Key)는 오라클 시퀀스를 이용할
것이다. MySQL이라면 자동증분 칼럼을 사용하니 특별히 생성할 필요 없다.(본 예제는 오라클을 기준으로 한다.)
<!--[if !supportLists]-->ü
<!--[endif]-->엔티티를 만들 때 키 부분(ID칼럼)에 어노테이션 사용하는 것만
DB가 무엇이냐에 따라 좀 다르니 확인하면 된다.
JPA에서 자동 생성된 DDL 스크립트는 다음과 같다.
create table board (
id number(10,0) not null,
content varchar2(4000 char) not null,
name varchar2(20 char) not null,
passwd varchar2(20 char) not null,
readcount number(5) default 0 not null,
regdate date default sysdate not null,
-- 답변인경우 어느글의 답변인지 상위글 번호,최상위글인 경우
자신의 글번호 동일,
-- 리스트보기에서 정렬시 우선 reply로 우선하게
된다.
reply number(5) not null,
-- 하나의 글 아래에 생기는 모든 답변들에 대해 순차적으로 1씩
증가(reply_level과 관계없이)
replylevel number(5) default 0 not null,
-- 1차,2차 답글인지 여부,
글에 답변이 두개면 그 두답변은
reply_level이 같다.
-- 리스트보기에서 reply_level에 따라 들여쓰기를
한다.
replystep number(5) default 0 not null,
title varchar2(500 char) not null,
primary key (id)
)
create sequence
BOARD_SEQ;
댓글 없음:
댓글 쓰기