In this tutorial you will learn about the use of annotations in Hibernate.
To create an example in Hibernate using Annotation reader must have aware with the following :
Hibernate also needs to provide a metadata for mapping the Object and Relational table. In Hibernate to provide a metadata, responsible for transforming the POJO class data to the database table and vice-versa, most commonly a XML file is used. Drawback of this way is that we are required to create an additional .hbm.xml file where we give all the mapping information that may cause a tiresome process. Use of Annotation in Hibernate makes it a powerful and easy way to provide the metadata transformation from the POJO class to the Relational table and vice-versa. The metadata, required to provide for transforming the POJO class data to the Relational table and vice-versa, is gathered into the POJO class as well as the code that helps the user to understand the structure of table and POJO at the same time.
Note : Annotations that are discussed above are of package javax.persistence
Click here for Hibernate 4 Annotation Example
Liked it! Share this Tutorial