Академический Документы
Профессиональный Документы
Культура Документы
BY:
NITIN BANSAL
What is
Hibernate is a framework that provides tools for objectrelational mapping (ORM) library for the Java language, for mapping an object -oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems.
Hibernate's primary feature is mapping from Java classes to database tables. We need to write a simple Java code and create an XML mapping file that describes the relationship between database and class attributes.
Why HIBERNATE?
Application
RDBMS
We have to store the data of Application in tables for multiple use. But there is a mismatch in mapping object oriented programming and Relational Database.
Why HIBERNATE?
Hibernate is introduced to overcome this mismatch.
It can be used to perform operations on the database like select, insert, update and delete the records in the table automatically and creates the query to perform these operations. Hibernate generates the SQL on the fly and automatically executes the necessary SQL statements. then
The main drawback of JDBC is that it doesnt allow to store objects directly to the database, we have to convert the objects to a relational format.
HIBERNATE ARCHITECTURE
Hibernat is highly configurable through two types of configuration files. The first type of named hibernate.cfg.xml. configuration file is
The second type of configuration file is a mapping description file (file extension *.hbm)
Features of HIBERNATE
Less Development Time
Database independence: Easy database switch without changing any code.
Transparent Persistence: It is the automatic mapping of Java objects with database tables and vice versa using runtime reflection.
Lazy Loading: This feature enable us to get only the required object instead of fetching all the entities associated with that. Hibernate provides Cache mechanism: It provides first level cache (By Session object) and second level cache (By Session factory object)
HIBERNATE Example
ADVANTAGES
Extensibility Reliability and Scalability Productivity Maintainability
DISADVANTAGES
Lots of API to learn Difficulty in Debugging