简体   繁体   English

从 Hibernate 实体生成 er 图

[英]Generate er diagram from Hibernate entity

I would like to generate ER diagram from Hibernate entities or Hibernate mapping.我想从 Hibernate 实体或 Hibernate 映射生成 ER 图。 I have selected visual paradigm tool which provides this feature.我选择了提供此功能的视觉范例工具。 I would like to know your feedback about visual paradigm or some other tools if you know which supports the above feature.如果您知道哪个支持上述功能,我想知道您对视觉范式或其他一些工具的反馈。

If you are using IntelliJ Idea (Ultimate) you can use Persistence Tool Window.如果您使用 IntelliJ Idea (Ultimate),则可以使用 Persistence Tool Window。 In order to use this feature, you have to add Java EE Persistence Framework Support to your project or module.为了使用此功能,您必须将 Java EE Persistence Framework Support 添加到您的项目或模块中。 ( Note: To do that, go to Project Tool Window: right-click a module folder and select Add Framework Support.) (注意:为此,请转到项目工具窗口:右键单击模块文件夹并选择添加框架支持。)

For the tool window to be available, there must be a JPA- or Hibernate-enabled module in your project, ie a module with a JPA or Hibernate facet.要使工具窗口可用,您的项目中必须有一个启用 JPA 或 Hibernate 的模块,即具有 JPA 或 Hibernate facet 的模块。

To open the tool window, do one of the following:要打开工具窗口,请执行以下操作之一:

  • Select View > Tool Windows > Persistence选择视图 > 工具窗口 > 持久性
  • If the tool window bars are currently shown, click the Persistence button (normally located at the lower-left part of the workspace).如果当前显示工具窗口栏,请单击 Persistence 按钮(通常位于工作区的左下角)。

After that, you can generate persistence mapping.之后,您可以生成持久性映射。 Then Right-click on the generated persistence unit and select “ER Diagram”.然后右键单击生成的持久性单元并选择“ER Diagram”。

References:参考:

Single version of truth单一版本的真相

Please do not use the entitys to modify the structure of the database:请不要使用实体来修改数据库的结构:

  1. if you add a non-null non-default column to a entity the database can not be changed if there are rows in that table because the initial value of that column can not be calculated.如果向实体添加非空非默认列,则如果该表中有行,则无法更改数据库,因为无法计算该列的初始值。
  2. If you add a fk to a table some values might have illegal references.如果您将 fk 添加到表中,则某些值可能具有非法引用。 You do not like to have this problems in deployment.你不喜欢在部署中遇到这个问题。

Use the tools of db managers instead please and calculate the entitys from the db.请改用数据库管理器的工具并计算数据库中的实体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM