Postgresql 如何从spring boot应用程序正确生成Postgres表?

Postgresql 如何从spring boot应用程序正确生成Postgres表?,postgresql,spring-boot,Postgresql,Spring Boot,我正在为未来的角度前端开发一个使用spring boot的RESTFUL API。我在将实体创建到postgres表时遇到了这个问题 已检查与数据库的连接,一切正常。使用mvn clean install和mvn spring boot run命令生成正常的tomcat部署,不会出现任何错误。但是,不创建任何表 这是我的密码: 实体: application.propreties: # =============================== # DATABASE CONNECTION #

我正在为未来的角度前端开发一个使用spring boot的RESTFUL API。我在将实体创建到postgres表时遇到了这个问题

已检查与数据库的连接,一切正常。使用mvn clean install和mvn spring boot run命令生成正常的tomcat部署,不会出现任何错误。但是,不创建任何表

这是我的密码: 实体:

application.propreties:

# ===============================
# DATABASE CONNECTION
# ===============================

spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres

# ===============================
# JPA / HIBERNATE
# ===============================

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect


# Fix Postgres JPA Error:
# Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
这是我的回购协议:

import model.Question;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface QuestionRepository extends JpaRepository<Question, Long> {
}
导入模型.问题;
导入org.springframework.data.jpa.repository.JpaRepository;
导入org.springframework.stereotype.Repository;
@存储库
公共接口问题库扩展了JpaRepository{
}

尝试将
spring.jpa.hibernate.ddl auto
属性更改为
create
值。

我可以通过更改实体包并使其对应用程序可见来解决此问题。现在它工作得非常好。 主程序包名称为:com.testAppBlaBla 实体的包应为com.testAppBlaBla.model


否则将不会生成实体

谢谢你的回答!我也遇到了同样的问题,然后,我将我的实体移动到包含DemoApplication类的包的子包中,它最终成功了!
import model.Question;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface QuestionRepository extends JpaRepository<Question, Long> {
}