0

I am newbie learning Java and Hibernate. I have this issue while creating a session. Can anyone let me know why I am getting such errors?

Nov 14, 2022 2:28:07 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate ORM core version 5.6.14.Final
Exception in thread "main" org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]
    at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53)
    at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:254)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:260)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:246)
    at com.HibernateTester.App.main(App.java:11)

I tried

SessionFactory factory = new Configuration().configure().buildSessionFactory();

or

SessionFactory factory = new Configuration().configure().buildSessionFactory(ServiceRegistry);

However, I'm unable to create a session.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • Still Unable to run. @Mark Rottveel could you help me please. The error is couldn't locate "hibernate.cfg.xml" file I have tried to put this file under package & SRC. Gave proper path still not working. – Shahzaib Khuwaja Nov 15 '22 at 04:31

0 Answers0