1.

What Do You Create A Sessionfactory?

Answer»

Configuration cfg = new Configuration();
cfg.addResource("myinstance/MyConfig.hbm.xml");
cfg.setProperties( System.getProperties() );
SessionFactory SESSIONS = cfg.buildSessionFactory();
First, we need to create an INSTANCE of Configuration and USE that instance to refer to the location of the configuration file. After configuring this instance is USED to create the SessionFactory by calling the method buildSessionFactory(). 

Configuration cfg = new Configuration();
cfg.addResource("myinstance/MyConfig.hbm.xml");
cfg.setProperties( System.getProperties() );
SessionFactory sessions = cfg.buildSessionFactory();
First, we need to create an instance of Configuration and use that instance to refer to the location of the configuration file. After configuring this instance is used to create the SessionFactory by calling the method buildSessionFactory(). 



Discussion

No Comment Found