-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JSF+Hibernate: Get atribute from dependent persistent class
PostPosted: Thu Mar 07, 2013 11:42 am 
Newbie

Joined: Thu Mar 07, 2013 6:43 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.