Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hb Configuration doubt

 
Rauhl Roy
Ranch Hand
Posts: 401
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



may i know what is happening in the above code.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!