Spring Boot - table 'project.diary' doesn't exist 오류
domain 패키지에 Diary 클래스(entity)를 생성 후 repository를 통해 save를 하는 도중
table 'project.diary' doesn't exist
오류가 발생했다.
entity를 생성하였는데 왜 오류가 났을까?
시도 1(실패)
@Entity(name="diary")
엔티티에 네임 설정하기
시도 2(실패)
private 뒤에 final을 추가하였다.
private final DiaryRepository diaryRepository;
시도3(성공)
application.properties 파일에 아래 코드 추가
spring.jpa.generate-ddl=true
참고
https://stackoverflow.com/questions/19140163/auto-creating-tables-failed-in-spring-jpa
Auto creating tables failed in Spring JPA
I have an issue with Spring JPA, Hibernate, MySQL. I have an Entity (Nom.java) and repository (public interface NomRepository extends JpaRepository<Nom, String>). They are created and injecte...
stackoverflow.com
'코드 정리 > 오류' 카테고리의 다른 글
오류 - 스프링 mysql 연동시 com.mysql.cj.jdbc.driver 에러(빨간줄) (0) | 2023.03.15 |
---|---|
스프링 - org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported 오류 (0) | 2023.03.06 |
Spring boot execute Error - finished with non-zero exit value 1 (0) | 2023.03.05 |
eclipse 오류 - The import jdk.nashorn cannot be resolved (0) | 2023.02.28 |
Java - Unreachable Statement에러 (0) | 2023.01.21 |