Hi Team,
I have an Entity which contains objects of other Entities:
PacDiaSms.java:
Code:
ManagedBean(name = "pacDiaSms")
public class PacDiaSms implements java.io.Serializable private String s;
private Integer idpacDiaSms;
private Mensaje mensajeByLunes;
private Mensaje mensajeByMiercoles;
private Mensaje mensajeByJueves;
private Mensaje mensajeBySabado;
private Mensaje mensajeByViernes;
private Paciente paciente;
private Mensaje mensajeByMartes;
private Mensaje mensajeByDomingo;
private Time hora;
constructors, getters, setters...
Mensaje.java:
Code:
@ManagedBean(name = "mensaje")
public class Mensaje implements java.io.Serializable {
private Integer idsms;
private String nombre;
private String texto;
private String selected;
constructor, getters, setters...
The problem comes when I try to retrieve the the data from the table Pac_Dia_Sms
Code:
public TablaSemana() {
Session session = HibernateUtil.getSession().openSession();
lista = session.createQuery("from PacDiaSms where paciente.idpaciente = 110"
).list();
session.close();
}
If close the session, I can't have access to the attributes of the object Mensaje inside PadDiaSms.
Is there any way to retrieve the object Mensaje with their attributes or to keep open the session and be able to open new sessions?
Thanks.