What is the code for Hibernate 5 Annotations Maven dependency?What is the code for Hibernate 5 Annotations Maven dependency?
Hibernate 5 uses annotations for annotating the Entity classes and configurations. Maven is best dependency management tool which used in industry to build the project, it downloads all the necessary jar files specified in the pom.xml file and add to the project.
The Hibernate 5 Annotations Maven dependency jar files is necessary to use the annotations in Hibernate 5 Java project. You can manually download add these jar files in project but these days this not the standard. According to the best practices you should use Maven pom.xml file to provide dependency configuration.
In Hibernate 5 all annotations dependency is distributed under the library Hibernate Commons Annotations. This includes necessary library for using annotations in Hibernate ORM project.
The latest version at the time of writing this tutorial was 5.0.1.Final.
The hibernate-commons-annotations project is the utility project which is internally used in Hibernate ORM applications. It supports Generic type discovery and also supports Java Annotations overriding through XML files. But these days Java Annotations overriding through XML files is not very frequent in use. Developers are mostly using Annotations and in very rare situations XML files are used.
Open your project in Eclipse.
Then open pom.xml file and add following dependency code:
<dependency> <groupId>org.hibernate.common</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>5.0.1.Final</version> </dependency>
Here are more Hibernate 5 tutorials: