如何使用spring boot从数据库创建实体类?

问题描述 投票:0回答:1

我正在Spring Tool Suite IDE上使用spring data jpa开发一个spring boot应用程序。我需要从数据库创建实体类,但我找不到任何答案如何做到这一点。

我看到了关于添加JPA Facet添加和使用它的答案。但我无法添加JPA Facet,因为我的应用程序是maven web,而不是jee应用程序。

java spring spring-boot spring-data-jpa spring-tool-suite
1个回答
0
投票

您不从数据库创建实体类。您可以创建模型来映射表及其与其他表的关系。

  1. 应用程序属性以配置JPA映射。

https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

  1. 将您的类映射到表。

https://www.vogella.com/tutorials/JavaPersistenceAPI/article.html#simple

© www.soinside.com 2019 - 2024. All rights reserved.