I'm new to hibernate and i have this problem.
If i do this:
Session sesion = HibernateUtil.getSessionFactory().openSession();
Transaction tx = sesion.beginTransaction();
A obj = (A) session.load(A.class,id);
System.out.println(obj);
tx.commit();
session.close();
return obj;
There is no problem and the gui shows the object's data.
But if i do this:
Session sesion = HibernateUtil.getSessionFactory().openSession();
Transaction tx = sesion.beginTransaction();
A obj = (A) session.load(A.class,id);
// i don't use System.out.println(obj);
tx.commit();
session.close();
return obj;
The gui doesn't show anything and i got the following exception.
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
I've been reading the api but it's a whole new world to me. Does anyone knows what's going on?