Hello, sorry for use this forum for some simple question, but i don't know what to do...
I create the hibernate.cfg.xml file, with the connection to the database and the mapping resources, and all the hbm.xml files for every table...
But i still having problems..
I have a Session var that is
Code:
private Session sesion;
sesion = HibernateUtil.getSessionFactory().openSession();
And the class HibernateUtil
Code:
public class HibernateUtil
{
private static final SessionFactory sessionFactory;
static
{
try
{
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (HibernateException he)
{
System.err.println("OcurriĆ³ un error en la inicializaciĆ³n de la SessionFactory: " + he);
throw new ExceptionInInitializerError(he);
}
}
public static SessionFactory getSessionFactory()
{
return sessionFactory;
}
}
The thing is that the system fails on the sentence
Code:
sessionFactory = new Configuration().configure().buildSessionFactory();
and gives the following errors
Code:
Exception in thread "main" java.lang.NullPointerException
at datos.IvaFechaDAO.getIvaFecha(IvaFechaDAO.java:44)
at negocio.IvaFecha.getIvaFecha(IvaFecha.java:7)
at presentacion.Inicio.main(Inicio.java:15)
I think that the problems is in the connection, but a problem is that i don't know if it is reading okey the hibernate.cfg.xml or not or where is the problem.
I appreciate any thing you could do to help me, i'm new in java! Thanks!