강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Không có người viết

Bài viết có thông tin người viết đã bị xóa.

Học React 19 qua Code với API Server Spring Boot

Tạo và kiểm tra dự án boot

테이블이 생성되지 않습니다

Viết

·

1.4K

·

Đã chỉnh sửa

0

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://localhost:3306/malldb
spring.datasource.username=malldbuser
spring.datasource.password=malldbuser

spring.jpa.hibernate.ddl
-auto = update
spring.jpa.prop
erties.hibernate.format_sql = true

 

 

@Entity
@ToString
@Getter
@Builder    // Builder 를 사용하게 되면 아래 2개의 어노테이션도 함께 사용해야함
@AllArgsConstructor
@NoArgsConstructor
public class ToDo {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String title;
    private String content;
    private boolean complete;
    private LocalDate dueDate;


}

 

위처럼 properties 를 작성했는데 ToDo 테이블이 생성되지 않습니다...오류는 전혀 뜨지 않고 있습니다...무엇이 문제인지 잘 모르겠습니다

reactspring-bootjpajwtredux-toolkit

Câu trả lời 2

0


여기에 있으면 될것 같아요

0

zk202308a5410님의 프로필 이미지
zk202308a5410
Người chia sẻ kiến thức

우선은 현재 상황에서 프로젝트 시작시에 에러가 안 나는지 확인해 주세요..

에러가 났다면 대부분 DB 연결이 안되서 그럴 것입니다.

 

테이블 생성과 관련해서는 application.properties 파일에

 

spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.show-sql=true

설정이 필요합니다. ddl-auto 값이 update로 되어 있으면 테이블이 생성됩니다.

 

 

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://localhost:3306/malldb
spring.datasource.username=malldbuser
spring.datasource.password=malldbuser

spring.jpa.hibernate.ddl
-auto = update
spring.jp
a.show-sql=true
spring.jpa.pro
perties.hibernate.format_sql = true

 

이렇게 properties 작성했고, Entity 는 기존과 동일합니다.

 

 

에러는 발생하지 않습니다.....

 

 

 

zk202308a5410님의 프로필 이미지
zk202308a5410
Người chia sẻ kiến thức

혹시 엔티티 클래스의 패키지의 위치가 다른게 아닐까 싶은데요..

프로젝트 초기 생성시에 만들어진 패키지 아래쪽에 있어야만 인식이 됩니다.

 

해결이 안되시면 cafe.naver.com/gugucoding으로 프로젝트 파일을 압축해서 올려주세요

Không có người viết

Bài viết có thông tin người viết đã bị xóa.

Đặt câu hỏi