简体   繁体   English

是否可以使用Hibernate工具在没有EJB的情况下使用Hibernate注释生成POJO?

[英]Is it possible to use Hibernate Tools to generate POJOs with Hibernate Annotations without EJB?

I'm using hibernate tools under Eclipse Indigo. 我正在Eclipse Indigo下使用休眠工具。 The Hibernate Console has Annotations option selected and hibernate version is 4.0. Hibernate控制台已选择“注释”选项,并且休眠版本为4.0。

The hibernate tools wizard generates annotations only when I choose Generate EJB3 Annotations option. 仅当我选择“生成EJB3注释”选项时,休眠工具向导才会生成注释。 This introduces a dependency on EJB, and I don't want it. 这就引入了对EJB的依赖,我不想要它。

How do I convince Hibernate tools to generate POJOs (via reverse engineering) that uses plain (non jpa) hibernate annotations? 如何说服Hibernate工具生成POJO(通过逆向工程)(使用反向(非jpa)休眠注释)?

Then you probably want to specify "Hibernate 3.x" as version, not 4.0. 然后,您可能要指定“ Hibernate 3.x”作为版本,而不是4.0。 If I remember correctly, Hibernate 4.0 provides JPA-only annotations, plus some few extra ones that would be "extensions". 如果我没记错的话,Hibernate 4.0提供了仅JPA的注释,以及一些额外的“扩展”注释。

Now, I think the real question is: why do you want to get rid of JPA? 现在,我认为真正的问题是:为什么要摆脱JPA? Note that EJB3 != JPA. 注意,EJB3!= JPA。 In fact, JPA is a replacement for what was once known as EJB Entity Beans. 实际上,JPA替代了曾经被称为EJB实体Bean的产品。 And that adding JPA dependency will not add an EJB dependency in your project. 而且,添加JPA依赖关系不会在项目中添加EJB依赖关系。

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

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