@Transactional(readOnly = true)가 인식되지않음
-> import javax.transaction.Transactional;으로 import되어있었음.
JPA 전용, readonly 인식 못함
-> import org.springframework.transaction.annotation.Transactional; 스프링용으로 import
-> 해결
2026-02-04T21:10:56.101+09:00 ERROR 28156 --- [plan] [ main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unable to build Hibernate SessionFactory [persistence unit: default] ; nested exception is org.hibernate.exception.SQLGrammarException: Unable to open JDBC Connection for DDL execution [Unknown database 'plan'] [n/a]
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2026-02-04T21:10:56.121+09:00 ERROR 28156 --- [plan] [ main] o.s.boot.SpringApplication : Application run failed
뭐가 잘못된건지 자꾸 코드가 종료되어서 찾아보니 application.properties에는 plan이라고 작성하고 데이터베이스는 plans로 작성...수정
2026-02-05T11:06:31.281+09:00 WARN 25252 --- [plan] [ main] ConfigServletWebServerApplicationContext :
Exception encountered during context initialization
- cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'commentController' defined in file
[C:\Users\1\Desktop\sparta실습\plan\build\classes\java\main\kr\spartaclub\plan\controller\CommentController.class]:
Unsatisfied dependency expressed through constructor parameter 0:
Error creating bean with name 'commentService' defined in file
[C:\Users\1\Desktop\sparta실습\plan\build\classes\java\main\kr\spartaclub\plan\service\CommentService.class]:
Unsatisfied dependency expressed through constructor parameter 0:
Error creating bean with name 'commentRepository' defined in
kr.spartaclub.plan.repository.CommentRepository defined in @EnableJpaRepositories declared on
DataJpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration:
No property 'id' found for type 'Plan'; Traversed path: Comment.plan
에러발생..
List<Comment> comments = commentRepository.findByPlanId(planId);
여기에서 findByPlanId 이 부분이 plan에서 id를 찾는건데 이름이 planId로 되어있어서 오류 발생 findByPlanPlanId로 수정완료
api 출력된 것을 보니 저자 정렬한 탓인지 id가 아래로 내려가있고 제목도 아래로 내려가있어서 중구난방인것을 수정
@JsonPropertyOrder({
"planId",
"commentId",
"commentContent",
"commentAuthor",
"createdAt",
"modifiedAt"
})
이 어노테이션을 사용해서 정렬
연결함수 지우기
readme 작성
예외처리 추가