Witam,
tworzę projekt na zaliczenie na uczelni i jedna rzecz mi nie chce pyknąć:
public String getZC(int ID) {
String ZC = "";
List<Przychody> pList = null;
try {
org.hibernate.Transaction tx = session.beginTransaction();
Query q = session.createQuery ("from Przychody where ID="+ID+"");
session.getTransaction().commit();
pList = (List<Przychody>) q.list();
} catch (Exception e) {
e.printStackTrace();
}
ZC = pList.get(0).toString();
return ZC;
}
Dostaje wyjątek:
org.hibernate.SessionException: Session is closed!
Co powinenem dopisać w projekcie i w którym miejscu?