inblog logo
|
p4rksk
    JavaSpringFrameWork

    28. 익명 게시판 만들기

    박선규's avatar
    박선규
    Feb 08, 2024
    28. 익명 게시판 만들기
    Contents
    첫 화면 (1)board 테이블 만들기(2)더미 데이터 만들기

    요구사항

    📌
    제목과 내용은 20자를 넘길 수 없음 글쓰기, 글 목록 보기, 글 수정하기, 글 삭제하기 구현
     

    첫 화면

    notion image

    (1)board 테이블 만들기

    package shop.mtcoding.blog.board; import jakarta.persistence.*; import lombok.Data; @Table(name = "board_tb") @Data @Entity public class Board { //이 테이블에서 구별 할 수 있는게 작성자 밖엥 없으니 작성자에 pk 걸기 @GeneratedValue(strategy = GenerationType.IDENTITY)//auto_increment int no; @Id String author; String title; String content; }
     
     

    (2)더미 데이터 만들기

    insert into board_tb(title,content,author,created_at) values ('제목1', '내용1','홍길동',now()); insert into board_tb(title,content,author,created_at) values ('제목2', '내용2','홍길동',now()); insert into board_tb(title,content,author,created_at) values ('제목3', '내용3','홍길동',now()); insert into board_tb(title,content,author,created_at) values ('제목4', '내용4','홍길동',now()); insert into board_tb(title,content,author,created_at) values ('제목5', '내용5','홍길동',now());
    📌
    더미 데이터에서는 스트링 타입 컬럼에 값을 넣을 때 “ “이 아닌 ‘ ‘로 넣어야 된다.
     
    Share article

    p4rksk

    RSS·Powered by Inblog