users@glassfish.java.net

Re: [Toplink] Problem getting the updated data

From: <glassfish_at_javadesktop.org>
Date: Wed, 19 Nov 2008 14:04:58 PST

@EJB DAOService daoservice;
....
.....
DAO queryDAO = daoservice.getDAO();
        clinic = queryDAO.getClinic(39);
        patient.setTimestamp(new Date());
        prefs = queryDAO.getReportPreferences(40);
        patient.setReportPrefs(prefs);
        patient.setClinic(clinic);
        Collection<Patient> patients = new ArrayList<Patient>();
        patients.add(patient);
        clinic.setPatients(patients);
        saveDAO.save(clinic);

here's stateless session bean
@Stateless
public class DAOServiceBean implements DAOService {

        EntityManagerFactory emf;
        
        public DAO getDAO() {
                DAOFactory daof = DAOFactory.getFactory(getEMF());
                DAO dao = daof.getDAO();
                return dao;
                
        }

        public EntityManagerFactory getEMF (){
                if (emf == null){
                        emf = Persistence.createEntityManagerFactory("ipro");
                }
                return emf;
        }
}
[Message sent by forum member 'vijaypangam123' (vijaypangam123)]

http://forums.java.net/jive/thread.jspa?messageID=317716