简体   繁体   English

IntelliJ IDEA Hibernate

[英]IntelliJ IDEA Hibernate

I'm learning hibernate and I am running into some issues. 我正在学习休眠,我遇到了一些问题。 I'm reading "Harnessing Hibernate" by O'Reilly. 我正在读O'Reilly的“Harnessing Hibernate”。 They explain everything using ANT, but since I want to avoid writing a huge build.xml file, I'm trying to get it to work with IntelliJ. 他们使用ANT解释所有内容,但由于我想避免编写一个巨大的build.xml文件,我试图让它与IntelliJ一起工作。

I managed to make a mapping according to a DB table in a MySQL database, and wrote the bean for it. 我设法根据MySQL数据库中的DB表进行映射,并为其编写bean。 It worked, but I can't find any information on how to generate beans and SQL code, or how to reverse engineer with IntelliJ. 它工作,但我找不到任何有关如何生成bean和SQL代码,或如何使用IntelliJ进行逆向工程的信息。 I found loads of tutorials about Eclipse, using JBOSS Hibernate tools plugin, and the site claims this support for generating code is already in the standard installation of IntelliJ. 我使用JBOSS Hibernate工具插件找到了大量有关Eclipse的教程,并且该网站声称这种生成代码的支持已经在IntelliJ的标准安装中。

Am I forgetting some configuration such as adding libraries? 我忘记了添加库等配置吗? I'm trying to find this out but I'm desperate now. 我试图找到这个,但我现在绝望了。 Please don't suggest me to use Eclipse, I need IntelliJ for my current role. 请不要建议我使用Eclipse,我需要IntelliJ作为我当前的角色。

AFAIK, IntelliJ IDEA includes the complete JPA/Hibernate support in its Ultimate Edition: AFAIK,IntelliJ IDEA在其Ultimate Edition中包含完整的JPA / Hibernate支持:

Generating Persistence Mappings from Database Schema 从数据库模式生成持久性映射

IntelliJ IDEA allows you to quickly generate persistence mappings from any database schema: Generating Persistance Mappings IntelliJ IDEA允许您从任何数据库模式快速生成持久性映射:生成持久性映射

替代文字
(source: jetbrains.com ) (来源: jetbrains.com

Now, the question is, what edition of Intellij IDEA are you using? 现在,问题是,您使用的是什么版本的Intellij IDEA?

If you add the hbm2ddl to your Hibernate config and ask it to create the database schema you'll get it by running a single test or some other code that exercises Hibernate. 如果你将hbm2ddl添加到你的Hibernate配置并要求它创建数据库模式,你将通过运行单个测试或其他一些运行Hibernate的代码来获得它。 Once you have it, turn off create. 一旦你拥有它,关闭创建。

Let Hibernate do the work. 让Hibernate完成这项工作。

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

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