Steps to
develop Hibernate Application:
1.
Develop entity
class for each table.
2.
For each
entity , develop a mapping file.
3.
Develop configuration
file.
4.
Add hibernate
framework jar files to class path.
5.
Using hibernate
api, perform persistent operations.
How to use
Hibernate Api to perform persistent operations:
We have
some steps to use hibernate api
1.
Create
configuration object
Configuration configuration=new
configuration();
2.
Read
configuration file along with mapping file using configure method.
Configuration.configure();
3.
Build
SessionFactory from configuration.
SessionFactory
factory=configuration.buildSessionFactory();
SessionFactory is thread safe
immutable cache of compiled
4.
Get Session
from SessionFactory object.
Session session=factory.openSession();
Session (org.hibernate.Session
)
A single-threaded Short lived object representing a conversation between app and persistent store.
5.
Perform persistent
operations.
Session
save(s)
Session
update(s)
Session
load(s)
Session
delete(s)
6.
Close the
session.
Session.close();
0 coment�rios:
Post a Comment