Wednesday, December 12, 2012

Hibernet Basics

Hibernet is a ORM tool
Hibernet used in data layer of application
Hibernet implenet JPA

y we use Hibernet?
we hv to persist(save) data to a db.
we want to save object(in java) data in a table(in db)
hv to map objects to tables for this.
map variable to columns.
map relatioships(foriegn key,primary key).
map data types.
managing changes to object state.

Hibernet is objects---Relationals-Mapping(ORM) tool

we want to tell to hibernet database details(host/uname/passwd)
want to tell to hibernet what are the objects want to save(for this use anotations)
we want to create a method to create a model object instance.(do this by Hibernet API)


Hibernet API tasts folowing...........

want to create session factory obj
then we can create sessions from session factory class
for each data base transaction(save/retreive/edit/delete/) hv to use one session object
for create a SF , we want to use configauration class and methods..
using sessionFactory we can create session objects..this session obj we want to use for db tranascations.......

EX-
UserDetails class
hibernet configuration class
Main class

using these we can send data to the database------

we can control the data format some way by using anotations like @Temperal,@Lob ,@Basic(),@etc..

using session obj we can send data to db
using session obj we can get data from db

No comments:

Post a Comment