Skip to content

Commit

Permalink
fix: JPA 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaisqls committed Oct 10, 2023
1 parent d42e52c commit eb9a989
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Answers(

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "post_id", columnDefinition = "BIGINT", nullable = false)
var post: Post = Post(),
var post: Post,

@Column(nullable = false, updatable = false, columnDefinition = "DATETIME(6)")
val createdAt: LocalDateTime = LocalDateTime.now(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import kr.hs.dsm.inq.domain.question.persistence.Answers
import kr.hs.dsm.inq.domain.question.persistence.Category
import kr.hs.dsm.inq.domain.question.persistence.Like
import kr.hs.dsm.inq.domain.question.persistence.LikeId
import kr.hs.dsm.inq.domain.question.persistence.Post
import kr.hs.dsm.inq.domain.question.persistence.Problem
import kr.hs.dsm.inq.domain.question.persistence.ProblemType
import kr.hs.dsm.inq.domain.question.persistence.QuestionTagsId
Expand Down Expand Up @@ -73,12 +74,15 @@ class QuestionService(
questions = questions
)

val post = postRepository.save(Post())

answersRepository.save(
Answers(
isExamplary = true,
answer = request.answer,
questions = questions,
writer = user
writer = user,
post = post
)
)

Expand Down

0 comments on commit eb9a989

Please sign in to comment.