This is my first time using Hiberante
.
I am trying to create a Hibernate session
within my application using the following:
Session session = HiberanteUtil.getSessionFactory().openSession();
It gives me this error:
org.hibernate.HibernateException: /hibernate.cfg.xml not found
However I do not have a hibernate.cfg.xml
file within my project.
How can I create a session without having this file?
The simples way to configure Hibernate 4 or Hibernate 5
Hibernate reads a configuration from
hibernate.cfg.xml
andhibernate.properties
.You shouldn't call
configure()
, if you don't want to readhibernate.cfg.xml
. With adding an annotated class