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

In this tutorial, we will explain how to make CRUD operations using Hibernate 4.3.6.

Operation SQL
Create INSERT
Read (Retrieve) SELECT
Update (Modify) UPDATE
Delete (Destroy) DELETE

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)  POM.xml

Add Hibernate 4.3.6 and Oracle 11.2.0 dependencies to the project.

2)  Create a resources folder under “src/main” folder,  and add Hibernate configuration and mapping file there. 

hibernate.cfg.xml

Employee.hbm.xml

3)  Employee.java

4)  EmployeeDAO.java

5)  HibernateUtil.java

6)  EmployeeService.java

7)  Project structure

Eclipse-Proj-Structure_Employee

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8)  Run EmployeeService.java and see output in eclipse

9)  In database

CRUD_Employee

 

 

 

 

 

 

Download Source Code

Posted in hibernate and tagged , , , .

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">