20

To keep it short and sweet:

There is hibernate-commons-annotations 4.1.0-Final and hibernate-annotations 3.5.6-Final.

I'm a nub, what's the difference between them, and do I need them both?

Trying to "avoid" JPA and by that I mean using the JPA 2.0 standards embedded within Hibernate.

Thanks!

Sam Levin
  • 3,326
  • 7
  • 30
  • 44

2 Answers2

39

Previously, hibernate-annotations was released and versioned from hibernate core. But from version 3.5 and up it is included with hibernate core. And for some reason it was still released from 3.5.0 to 3.5.6 but you do not need it anymore.

And coming to hibernate-commons-annotations, it is a utility project used by annotations based hibernate sub-projects. It is used by other hibernate projects like hibernate-search and thus is maintained as a separate project and it is a compile time dependency for hibernate-core v3.6.0 and up.

Source 1 Source 2

Ravi Kadaboina
  • 8,494
  • 3
  • 30
  • 42
1

Hibernate Commons Annotations is "Utility project for annotation handling", as said for example here. It does not contain such API that normal user of Hibernate should use.

Hibernate annotations contained persistence mapping annotations and related code. Nowadays it is merged to Hibernate core.

If you really want to avoid JPA (1/2) that is easily done by not using classes from javax.persistence package or from its subpackages. If you want opposite, use javax.persistence and avoid org.hibernate packages where possible.

Good guide to get started with Hibernate can be found from http://docs.jboss.org/hibernate/orm/4.1/quickstart/en-US/html_single/. It also tells which libraries are needed always and which ones are optional.

Reference documentation contains plenty of advices about using JPA instead of deprecated legacy Hibernate annotations.

Mikko Maunu
  • 41,366
  • 10
  • 132
  • 135