Hibernate Intro 1
Hibernate Intro 1
-------------
Trainer Name:Monal Zope
BE Computers in 2001
Hibernate is a Framework??
--------------------------
Framework is semi-developed code which can be customized to develop our application
faster
Object Persistence
------------------
we want to store object state permanently
Employee e=new Employee(101,"RObert",78900);
Application Layers
--------------------
Presentation Layer[UI]--->Swing,HTML,JSP
Business Layer[Business logic]--->Java Bean,EJB,Servlet
Persistence Layer[Data Access]--->Hibernate,JDBC
Persistence Mechanisms
----------------------
1)JDBC:-
-----
application connects to the db via DriverManager/
DataSource[Connection Pooling]
Cons:-
repeated coding
transaction & concurrency needs to be done manually
caching & dynamic update require extra efforts
___________________________________________________________
2)Serialization
--------------
Serialization is process of converting object state into a bytestream.
This bytestream can then be stored into file/transfer across network
Pros:-
automated object peristence in a file
[
we just need to pass object to a method writeObject()
class need to implements Serializable
]
Cons:-
object--->bytestream---->file [slow]
hence not suitable for large scale data
Pros:-
stores structured data in a text format[hence best suited for transferring data
between heterogeneous systems]
Cons:-
Not good for large scale data
___________________________________________________________
Cons:-
i)developing EJB is overcomplex[need to implement specific interfaces]
ii)requires Managed Environment [requires Application Server]
iii)Not portable
Simple as JDBC
Automated like SErialization,EJB
Pluggable like XML
Employee[POJO]--->empId,empName,empSal[POJO properties]
empdb--->eid,ename,esal
advantages
1)Better System Architecture
2)Reduces Coding Time
3)Caching & Transaction mgt is inbuilt
ORM implementations
Hibernate,TopLink,EJB Entity Bean,IBatis/MyBatis
____________________________________________________
Hibernate
-----------
-Hibernate is a ORM framework which maps java object to relational db based on the
metadata we provide using xml/annotation
-open source
[go to the website--->download jar files free of cost]
http://www.hibernate.org