用于创建基于 mysql 数据库的基本映射的 Hibernate 工具

发布于 2024-08-23 21:05:51 字数 85 浏览 2 评论 0原文

是否有任何工具可以查看数据库并生成基本映射文件?

如果它可以使用数据库并使用注释创建实际模型(java 类),那就太好了,但不确定是否存在?

Are there any tools that can look at a database, and generate the basic mapping files?

It would be great if it could take a database, and create the actual model (java classes) with annotations, but not sure if that exists?

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

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

发布评论

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

评论(4

缪败 2024-08-30 21:05:51

Hibernate 3 有一个名为 Hibernate Tools 的工具集,它提供了 Eclipse 插件和 Ant 任务,两者都支持逆向工程

逆向工程:Hibernate Tools 最强大的功能是数据库逆向工程工具,它可以生成域模型类和 Hibernate 映射文件、带注释的 EJB3 实体 bean、HTML 文档甚至整个 JBoss Seam几秒钟内即可申请!

...

Ant 任务:Hibernate3 工具包含一个统一的 Ant 任务,允许您在构建过程中运行架构生成、映射生成或 Java 代码生成。

对于 Eclipse 插件,请查看 文档的这一部分。对于 Ant 任务,请查看有关 逆向工程以及可选的如何控制它

请注意,其他 IDE 也提供对逆向工程的支持(请参阅 Hibernate Reverse Engineering for Netbeans 6.5从 IntelliJ 的数据库架构生成持久性映射)。

Hibernate 3 has a toolset called Hibernate Tools that provides an Eclipse plugin and an Ant task that both support Reverse Engineering:

Reverse Engineering: The most powerful feature of Hibernate Tools is a database reverse engineering tool that can generate domain model classes and Hibernate mapping files, annotated EJB3 entity beans, HTML documentation or even an entire JBoss Seam application in seconds!

...

Ant task: The Hibernate3 tools include a unified Ant task that allows you to run schema generation, mapping generation, or Java code generation as part of your build.

For the Eclipse plugin, have a look at this section of the documentation. For the Ant task, have a look at the section about reverse engineering and optionally how to control it.

Note that other IDEs also provide support for reverse engineering (see Hibernate Reverse Engineering for Netbeans 6.5 and Generating Persistence Mappings from Database Schema for IntelliJ).

氛圍 2024-08-30 21:05:51

我只是偶然发现了这个问题,我想我已经找到了一个完美的工具来完成这项工作。

http://hibernatepojoge.sourceforge.net/


功能:(如果您是懒得浏览提供的链接)

  • 使用 Hibernate 中使用的注释来表示每个表的 Java 对象。
  • 每个表一个 JUnit 测试用例,使用生成的对象来创建、填充、保存、检索和比较结果 每个
  • 类的 DAO
  • 相应的枚举文件
  • Spring 和 hibernate 配置
  • DAO 层
  • 每个模式一个数据工厂类,用于返回随机的预填充对象数据(用于边界检查、数据库填充等)

还支持:

  • 连接表,包括链接表中带有附加字段的
  • 表 多态性/继承支持
  • 组合键
  • 一对一、多对一、多-to-many 等
  • 多种模式支持(4 种模式)
  • 自然键
  • 枚举(包括那些无法干净地映射到 java 世界的条目)
  • 一大堆更多的东西(参见 example.xml)

我还想说的是设置这很简单;您只需要有一个 hibernate 配置文件和从站点下载的 jar 文件即可。然后只需执行一个 jar 文件,并将 config.xml 作为参数传递即可!

I just happened to stumble across this problem and I think I have found a perfect tool for the job.

http://hibernatepojoge.sourceforge.net/


Features : (in case you are lazy to go through the provided link)

  • Java objects representing each table using annotations for use with Hibernate.
  • A JUnit test case per table that uses the objects generated to create, populate, save, retrieve and compare results
  • DAO per class
  • The appropriate enumeration files
  • Spring and hibernate configuration
  • DAO layers
  • A data factory class per schema to return a pre-populated object with random data (for boundary checking, database population, etc)

Also supports:

  • Join tables including those with additional fields in link tables
  • Polymorphism/inheritance support
  • Composite Keys
  • One-To-One, many-to-one, many-to-many, etc
  • Multiple schema support (4 modes)
  • Natural Keys
  • Enumerations (including those entries which cannot be mapped cleanly onto the java world)
  • A whole bunch of more stuff (see sample.xml)

I would also like to say that setting this up is quite straight forward; You just have to have a hibernate configuration file and the jar file downloaded from the site. Then it's just a matter executing a jar file, passing the config.xml as a parameter!

在巴黎塔顶看东京樱花 2024-08-30 21:05:51

如果您使用的是 eclipse 或 ant...

Jboss 工具

If you are using eclipse or ant...

Jboss tools

ヤ经典坏疍 2024-08-30 21:05:51

您可能会在这里找到您需要的内容,我是即时找到的:MyGeneration。

我知道还有其他人存在,但我不记得了。希望这有帮助!

You might find what you need here, I found it on the fly: MyGeneration.

I know there are others that exist, but I don'T remember by heart. Hope this helps!

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