gpt4 book ai didi

java - JPA/JSP/EJB : How to create tables from entities?

转载 作者:行者123 更新时间:2023-12-01 13:36:40 24 4
gpt4 key购买 nike

我正在学习如何将 JPA 与 NetBeans/Glassfish 结合使用。

我创建了一个新的 EE 项目,以及 EJB 中的一些实体。我还创建了一个新数据库。在创建实体时,我还创建了一个新的持久性单元。在“数据源”中,我选择了“新数据源”,对于数据库连接,我使用了之前创建的数据库连接。

但是当我查看数据库的服务时,我没有看到任何与实体对应的表。我现在应该做什么?

enter image description here enter image description here

感谢您的帮助。很抱歉,如果问题很明显,但我对这种编程真的很陌生。

最佳答案

JPA (2.1) 允许您 create the schema appropriate for your JPA entities创建 EntityManagerFactory 时在持久性单元中。链接页面告诉您要在持久性单元中指定哪些持久性属性才能自动发生此操作。 (假设您的 JPA 实现适用于 JPA 版本 2.1)

关于java - JPA/JSP/EJB : How to create tables from entities?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21220211/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com