solution:

correct code:

If your cfg is placed in different location or if it is renamed then load your cfg file manually in configure method
sessionFactory = new Configuration().configure(“com\\xml\\hibernate.cfg.xml”).buildSessionFactory();
for complete code visit here