CRUD (Create,Read,Update,Delete) operations using Hibernate 4.3.6 + Maven 3.2.3 + Oracle 11.2 + ANNOTATION

In previous tutorial we have seen CRUD operations using Hibernate Mapping file.

In this tutorial we will see the same example but using JPA annotations.

Tools & technologies used in this article:

  1. Java 1.6
  2. Maven 3.2.
  3. Hibernate 4.x
  4. Oracle 11.2.0
  5. Eclipse

1) We will use previous tutorial resources. We no need to change anything for below. 


2) Delete Employee.hbm.xml (hibernate mapping file)

3) Update Hibernate.cfg.xml

Update the below line

To this line

4) Update Model (

In, we have used JPA annotation.

5) Project Structure














6) Run and see output in eclipse

Drop the Employee table in database using DROP TABLE EMPLOYEE; and  run

 7) In database








Download Source Code

Posted in hibernate and tagged , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.