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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
It is sorta covered in the JavaRanch Style Guide.
subject: hb Configuration doubt
Similar Threads
Can Any one help not found
org.hibernate.MappingException: Association references unmapped class com.db.Soundtracks
Session onject throwing exception when trying to save a object or begin a transaction
Problem with Hibernate and Oracle
Dividing hibernate.cfg.xml into many files