Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home4/vir007/public_html/geekmantra.com/contact/connect.php on line 2
Free Online Hibernate Architecture Tutorials in Hibernate,Hibernate Architecture in Hibernate
GeekMantra
Search Site

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home4/vir007/public_html/geekmantra.com/contact/connect.php on line 2
J2SE [Java 2 Standard Edition]
Core Java Introduction
Exception Handling
Collection & Util Classes
Multithreading
Input & Output Streams
Applet
Adwance Windows Toolkit (AWT)
Swings (Adwance GUI)
Event Handling
Java Networking
Remote Method Invocation (RMI)
Java Database Connectivity (JDBC)
J2EE [Java 2 Enterprise Edition]
Java 2 Enterprise Edition Intoduction (J2EE)
Server Side Programming (Servlet)
Java Server Pages (JSP)
Enterprise Java Bean
MVC Framework (Struts)
Advance Framework (Springs)
Object-relational mapping (Hibernate)
eXtensible Markup Language (XML)
Asynchronous JavaScript and XML (AJAX)
Miscellneous
Monthly News Letter
Free SCJP Samples
Interviews Questions For Freshers
Interviews Questions For Experinced
Most Visited Links
Most Freaky Links
Advertisements

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home4/vir007/public_html/geekmantra.com/contact/connect.php on line 2

Object Relational Mapping

• A DAO can use an ORM framework for persistence tasks.
• ORM framework is written to reduce the efforts done by DAO classes, like database connectivity,
   constructing sql queries etc.
• ORM also improve the performance of DAO layer by providing caching, query optimization etc.
• Even ORM take care of database independency that’s why we do not require using factory method and
   abstract factory pattern at DAO layer for achieving the same.
• DAO was 2 step approach, ORM will be introduced as a 3rd step, see the figure below.
• ORM will provide n number of features that we will see shortly.

Hibernate ORM

There are other options also TopLink, iBatis, JDO, EJB-Entity Beans etc but hibernate is much more powerful
and simple to use.

Using Hibernate 4 step process

We want to persist a record that keep the information about a employee through Hibernate.

Step 1 – Entity class
need to be persisted --> Employee.java ~= EmployeeTO.java

Step 2 –
Hibernate requires a mapping file (employee.hbm.xml), that keep the information like table belongs to
this employee class, column mapping and association of this entity with other existing entities.

Step 3 – framework configuration file (hibernate.cfg.xml) keeping the information about the database
connection properties, mapping files locations of entities created in step 2 etc.

Step 4 – client program where we will take Hibernate’s SessionFactory and Session then will call save(),
update() etc. method to perform persistency.

Hibernate Example

Hibernate Example

Hibernate Example

Hibernate Example