Hibernate Annotations Posted on: October 26, 2010 at 12:00 AM
Learn about Hibernate Annotations and its importance in development of applications.
In this section we will learn about Hibernate Annotations and understand how
Hibernate Annotations is simplifying the programming.
The default method of providing the metadata to the Hibernate is the xml
file. In the xml file (hibernate.cfg.xml) the database connection information
and other configuration information is provided. There is another file Hibernate
mapping file (*.hbm.xml) which is used to map the entity with the database
table. Sometimes its very tedious method and take a lot of effort to modify the
existing file if there is some change in database. Now hibernate provides
another way to provide the mapping metadata to the application. It is known as
Hibernate annotations and it based on the Java 5 annotations. So, to use
Hibernate Annotations you should have Java 5 and Hibernate 3 or above.
Bothe Hibernate Annotations and JPA Annotations are versioned and released
from the Hibernate Core 3.5.
Here are the benefits of using Hibernate annotations:
Easy maintenance of the application
Now the mapping information are saved into same Entity class
(java file) making the modification very easy.
It is fully compliant with JPA.
Here are the list of Hibernate Annotations classes: