Prabhakar Bokka wrote:hibernate.cfg.xml should be placed in the source directory of your project.
If you are using package structure, it should be out of packages, not beside your class file.
If you want to place beside your class file, you have to mention the path.
SessionFactory sessionFactory = new Configuration().configure("path").buildSessionFactory();