diff --git a/server/src/main/java/com/yogit/server/board/entity/Board.java b/server/src/main/java/com/yogit/server/board/entity/Board.java index 927510e..df5385a 100644 --- a/server/src/main/java/com/yogit/server/board/entity/Board.java +++ b/server/src/main/java/com/yogit/server/board/entity/Board.java @@ -10,6 +10,7 @@ import javax.persistence.*; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; @Entity @@ -17,7 +18,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Board { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "board_id") private Long id; @@ -49,8 +50,8 @@ public class Board { private int totalMember; - @OneToMany(mappedBy = "board") - private List boardUsers; + @OneToMany(mappedBy = "board", cascade = CascadeType.ALL) // 보드 생성 순간 보드 유저 리스트 생성 + private List boardUsers = new ArrayList<>(); @OneToMany(mappedBy = "board") private List boardImages; diff --git a/server/src/main/java/com/yogit/server/board/entity/BoardImage.java b/server/src/main/java/com/yogit/server/board/entity/BoardImage.java index 58299b3..559c04a 100644 --- a/server/src/main/java/com/yogit/server/board/entity/BoardImage.java +++ b/server/src/main/java/com/yogit/server/board/entity/BoardImage.java @@ -11,7 +11,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class BoardImage { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "board_image_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/board/entity/BoardUser.java b/server/src/main/java/com/yogit/server/board/entity/BoardUser.java index f460fc2..6d00bfa 100644 --- a/server/src/main/java/com/yogit/server/board/entity/BoardUser.java +++ b/server/src/main/java/com/yogit/server/board/entity/BoardUser.java @@ -12,7 +12,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class BoardUser { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "board_user_id") private Long id; @@ -31,6 +31,6 @@ public class BoardUser { public BoardUser(User user, Board board) { this.user = user; this.board = board; - board.addBoardUser(this); +// board.addBoardUser(this); } } diff --git a/server/src/main/java/com/yogit/server/board/entity/BookMark.java b/server/src/main/java/com/yogit/server/board/entity/BookMark.java index 56665ab..1f668fb 100644 --- a/server/src/main/java/com/yogit/server/board/entity/BookMark.java +++ b/server/src/main/java/com/yogit/server/board/entity/BookMark.java @@ -12,7 +12,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class BookMark { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "book_mark_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/board/entity/Category.java b/server/src/main/java/com/yogit/server/board/entity/Category.java index 5f4a907..6ae09b7 100644 --- a/server/src/main/java/com/yogit/server/board/entity/Category.java +++ b/server/src/main/java/com/yogit/server/board/entity/Category.java @@ -11,7 +11,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Category { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "category_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/board/entity/ClipBoard.java b/server/src/main/java/com/yogit/server/board/entity/ClipBoard.java index 43d6af9..7a5804c 100644 --- a/server/src/main/java/com/yogit/server/board/entity/ClipBoard.java +++ b/server/src/main/java/com/yogit/server/board/entity/ClipBoard.java @@ -13,7 +13,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class ClipBoard { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "clip_board_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/board/entity/Comment.java b/server/src/main/java/com/yogit/server/board/entity/Comment.java index 438fcee..9d21fd0 100644 --- a/server/src/main/java/com/yogit/server/board/entity/Comment.java +++ b/server/src/main/java/com/yogit/server/board/entity/Comment.java @@ -12,7 +12,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Comment { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "comment_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java b/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java index 0df86a7..7f86229 100644 --- a/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java +++ b/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java @@ -48,7 +48,7 @@ public ApplicationResponse createBoard(CreateBoardReq dto){ board.changeBoardCurrentMember(0);// currentMember 디폴트=0 // 호스트 boardUser 생성 및 board에 추가 -// board.addBoardUser(new BoardUser(host, board)); + board.addBoardUser(new BoardUser(host, board)); // board 저장 Board savedBoard = boardRepository.save(board); diff --git a/server/src/main/java/com/yogit/server/user/entity/City.java b/server/src/main/java/com/yogit/server/user/entity/City.java index 3d6e639..9bd1392 100644 --- a/server/src/main/java/com/yogit/server/user/entity/City.java +++ b/server/src/main/java/com/yogit/server/user/entity/City.java @@ -15,7 +15,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class City { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "city_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/user/entity/CountryCode.java b/server/src/main/java/com/yogit/server/user/entity/CountryCode.java index 22841b7..8bcc6e5 100644 --- a/server/src/main/java/com/yogit/server/user/entity/CountryCode.java +++ b/server/src/main/java/com/yogit/server/user/entity/CountryCode.java @@ -11,7 +11,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class CountryCode { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "country_code_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/user/entity/Interest.java b/server/src/main/java/com/yogit/server/user/entity/Interest.java index d4d87bb..d26de6f 100644 --- a/server/src/main/java/com/yogit/server/user/entity/Interest.java +++ b/server/src/main/java/com/yogit/server/user/entity/Interest.java @@ -13,7 +13,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Interest { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "interest_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/user/entity/Language.java b/server/src/main/java/com/yogit/server/user/entity/Language.java index 181f898..76a0b43 100644 --- a/server/src/main/java/com/yogit/server/user/entity/Language.java +++ b/server/src/main/java/com/yogit/server/user/entity/Language.java @@ -9,7 +9,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Language { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "language_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/user/entity/User.java b/server/src/main/java/com/yogit/server/user/entity/User.java index ff77823..75308bd 100644 --- a/server/src/main/java/com/yogit/server/user/entity/User.java +++ b/server/src/main/java/com/yogit/server/user/entity/User.java @@ -15,7 +15,7 @@ public class User { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/user/entity/UserImage.java b/server/src/main/java/com/yogit/server/user/entity/UserImage.java index 76341ca..a3a43f9 100644 --- a/server/src/main/java/com/yogit/server/user/entity/UserImage.java +++ b/server/src/main/java/com/yogit/server/user/entity/UserImage.java @@ -11,7 +11,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class UserImage { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_image_id") private Long id; diff --git a/server/src/main/java/com/yogit/server/user/entity/UserInterest.java b/server/src/main/java/com/yogit/server/user/entity/UserInterest.java index 1ffeede..0ca5cdb 100644 --- a/server/src/main/java/com/yogit/server/user/entity/UserInterest.java +++ b/server/src/main/java/com/yogit/server/user/entity/UserInterest.java @@ -11,7 +11,7 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public class UserInterest { @Id - @GeneratedValue(strategy = GenerationType.AUTO) + @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "user_interest_id") private Long id;