My Quotes


When U were born , you cried and the world rejoiced
Live U'r life in such a way that when you go
THE WORLD SHOULD CRY






Sunday, February 17, 2013

Hibernate 4 and Configuration

If you use 
configuration = new Configuration();
configuration.configure(<<hibernate.cfg.xml");

You will see the warning 
configuration.configure is deprecated.

To get rid of this do the following

Configuration configuration =null;
ServiceRegistry serviceRegistry =null;
try{
configuration = new Configuration();
configuration.configure(hibernateConfigFile);
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
factory = configuration.buildSessionFactory(serviceRegistry);
}

This will get rid of the warning

No comments :