Skip to content

Commit

Permalink
refactor : hibernate 옵션 수정/에러 맵핑
Browse files Browse the repository at this point in the history
  • Loading branch information
OZIIJIN committed Nov 23, 2024
1 parent b8bb6d6 commit a89d330
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.example.demo.domain.dto.answer;

import com.example.demo.domain.entity.answer.Answer;
import lombok.Getter;

@Getter
public class AnswerCreateResponseDto {

private String uuid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.example.demo.domain.dto.answer;

import lombok.Getter;

@Getter
public class AnswerResponseDto {

private String question;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class QuestionService {
public QuestionResponseDTO getRandomQuestion(QuestionCategory category) {

List<Long> questions = questionQuery.findIdByQuestionCategory(category);
if(questions.isEmpty()) {
throw new GeneralException(ErrorStatus.QUESTION_NOT_FOUND.getReasonHttpStatus());
}

Random random = new Random();
Long randomNumber = questions.get(random.nextInt(questions.size()));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
ddl-auto: create # 처음에는 create -> 나중에는 update
ddl-auto: update # 처음에는 create -> 나중에는 update
show-sql: true
spring:
servlet:
Expand Down

0 comments on commit a89d330

Please sign in to comment.