If you are using hibernate version 4.x.x then you might have seen that when we create a SessionFactory object we get an warning saying The method buildSessionFactory() from the type Configuration is deprecated.
SessionFactory factory = new Configuration(). configure().
Replace the SessionFactory code with the below lines :
Configuration conf = new Configuration().configure("hibernate.cfg.xml"); StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()); SessionFactory factory = conf.buildSessionFactory(builder.build());
Code2care'smission is to share varied knowledge in technical and non-technical areas gathered during day-to-day learnings and development activities so that our visitors can leverage this portal to find solutions to their queries without re-inventing the wheel. Technical posts include Learnings, Tutorials, Video Tutorials, Code Snippets, Tips-n-tricks.