File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes hb Configuration doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hb Configuration doubt" Watch "hb Configuration doubt" New topic

hb Configuration doubt

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

may i know what is happening in the above code.
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

The above code does the following:
1- Instantiate a configuration object, which allows the application to specify properties and mapping documents.
2- Use the mapping and properties specified in a resource called 'hibernate.cfg.xml' to configure hibernate.
3- Instantiate a new SessionFactory using the the property file used in step 2.
4- Return a SessionFactory object, which is used to create database sessions, transactions, etc.

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
I agree. Here's the link:
subject: hb Configuration doubt
It's not a secret anymore!