如何将基于实体的图转换为 JPA java 代码

发布于 2024-12-16 23:16:21 字数 122 浏览 6 评论 0原文

我有使用“Sparx Enterprise Architect v8.0”创建的类图,我需要生成基于 JPA 的类,并带有反映在代码中使用它的关系的注释。 问题是我可以将其转换为 EJB,但不能将其转换为我的任务所需的 JPA。

I have class diagram created with "Sparx Enterprise Architect v8.0" and i need to generate JPA-based classes with annotations that reflect relations to use it in the code.
The problem is that i can convert it to EJB but not JPA which is required for my task.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

尸血腥色 2024-12-23 23:16:21

我不知道这个产品,但是他们声称它:

支持数据库模式建模以及为 11 个开箱即用的 DBMS 目标自动生成 DDL 脚本

一旦您拥有了数据库模式,我相信有各种工具可以对其进行逆向工程并生成 JPA 实体。 Google 中的一些随机点击:

I don't know this product, however they claim that it:

supports modeling of database schema and automatic generation of DDL scripts for eleven DBMS targets out-of-the-box

Once you have the database schema I believe there are various tools that can reverse engineer it and generate JPA entities. Few random hits in Google:

撩人痒 2024-12-23 23:16:21

查看 Netbeans 的 JPA Modeler,它将最适合您的要求:

从类图中生成数据库架构和 DAO 类

您可以在此处找到演示:JPA Modeler 演示 - Youtube< /a>

Have a look at the JPA Modeler for Netbeans, will be best fit for your requirement :

generate the database schema and DAO classes from class diagram

You can find the demo here : JPA Modeler Demo - Youtube

被翻牌 2024-12-23 23:16:21

如果将模型导出为 ecore 格式,则可以使用 Texo 为模型生成 JPA 注释的 POJO。

If you export your model to ecore format, then you can use Texo to generate JPA annotated POJO for your model.

玩心态 2024-12-23 23:16:21

Spring Tool Suit 中 Marketplace 的 G9 插件完成了工作。

  1. 安装插件 G9
  2. 选择项目(JAVA)
  3. 导入“导入数据库模型”
  4. 选择 JDBC 驱动程序(在我的例子中是 mysql)
  5. 维护 JDBC 连接
    • 提供驱动程序名称、添加 Jar、端口、驱动程序类和连接 URL 以及架构 (jdbc:mysql://localhost:3306/{schema_name})
  6. 关闭 JDBC 连接框
  7. 端口,数据库名称、用户名和 PWD
  8. 获取

参考 URL https://www.esito.no/produkter/dbimport/

G9 plugin from Marketplace in Spring Tool Suit did job.

  1. Install Plugin G9
  2. Select Project (JAVA)
  3. Import "Import Database Model"
  4. Select JDBC Driver (In my case mysql)
  5. Maintain JDBC Connection
    • New
    • Provide Driver Name, Add Jar, Port, Driver Class and connection url along with schema (jdbc:mysql://localhost:3306/{schema_name})
  6. Close JDBC Connection Box
  7. Port, DB Name, User Name and PWD
  8. Fetch

Reference URL https://www.esito.no/produkter/dbimport/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文