[英]Hibernate tool to create basic mappings based on a mysql db
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? 如果可以使用数据库,并使用注释创建实际模型(java类),但不确定是否存在,那将会很棒?
Hibernate 3 has a toolset called Hibernate Tools that provides an Eclipse plugin and an Ant task that both support Reverse Engineering : Hibernate 3有一个名为Hibernate Tools的工具集,它提供了一个Eclipse插件和一个支持逆向工程的Ant任务:
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! 逆向工程: Hibernate Tools最强大的功能是数据库逆向工程工具,可以在几秒钟内生成域模型类和Hibernate映射文件,带注释的EJB3实体bean,HTML文档甚至整个JBoss Seam应用程序!
... ...
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. Ant任务: Hibernate3工具包含一个统一的Ant任务,允许您在构建过程中运行模式生成,映射生成或Java代码生成。
For the Eclipse plugin, have a look at this section of the documentation. 对于Eclipse插件,请查看文档的这一部分 。 For the Ant task, have a look at the section about reverse engineering and optionally how to control it . 对于Ant任务,请查看有关逆向工程的部分以及可选的控制方法 。
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). 请注意,其他IDE也提供对逆向工程的支持(请参阅针对Netbeans 6.5的Hibernate逆向工程和从 IntelliJ的数据库架构生成持久性映射 )。
I just happened to stumble across this problem and I think I have found a perfect tool for the job. 我碰巧遇到了这个问题,我想我找到了一个完美的工具。
http://hibernatepojoge.sourceforge.net/ http://hibernatepojoge.sourceforge.net/
Features : (in case you are lazy to go through the provided link) 特点:(如果你懒得通过提供的链接)
Also supports: 还支持:
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. 您只需拥有一个hibernate配置文件和从该站点下载的jar文件。 Then it's just a matter executing a jar file, passing the config.xml
as a parameter! 然后,只需执行一个jar文件,将config.xml
作为参数传递!
If you are using eclipse or ant... 如果你正在使用eclipse或ant ...
You might find what you need here, I found it on the fly: MyGeneration . 你可能会在这里找到你需要的东西,我在飞行中找到它: MyGeneration 。
I know there are others that exist, but I don'T remember by heart. 我知道还有其他的存在,但我不记得。 Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.