简体   繁体   中英

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

I'm using hibernate tools under Eclipse Indigo. The Hibernate Console has Annotations option selected and hibernate version is 4.0.

The hibernate tools wizard generates annotations only when I choose Generate EJB3 Annotations option. This introduces a dependency on EJB, and I don't want it.

How do I convince Hibernate tools to generate POJOs (via reverse engineering) that uses plain (non jpa) hibernate annotations?

Then you probably want to specify "Hibernate 3.x" as version, not 4.0. If I remember correctly, Hibernate 4.0 provides JPA-only annotations, plus some few extra ones that would be "extensions".

Now, I think the real question is: why do you want to get rid of JPA? Note that EJB3 != JPA. In fact, JPA is a replacement for what was once known as EJB Entity Beans. And that adding JPA dependency will not add an EJB dependency in your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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