ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

How do we create session factory in hibernate?

To create a session factory in hibernate, an object of configuration is created first which refers to the path of configuration file and then for that configuration, session factory is created as given in the example below:

Configuration config = new Configuration();

config.addResource("myinstance/configuration.hbm.xml");

config.setProperties( System.getProperties() );

SessionFactory sessions = config.buildSessionFactory();

Related Posts Plugin for WordPress, Blogger...
Flag Counter