Problem with ViewScoped RequestScoped and Session

0

I have the following scenario:

A DataTable where it has a button which executes a Bean method, however this DataTable is using a Paging with Lazy Loading, however according to the session annotation that I use the button method is not executed or the session is closed.

If you use the annotation Bean:

javax.enterprise.context.RequestScoped

All the search for popular DataTable is executed, however the edit button when triggered does not execute the Bean method.

The annotation is already used in the Bean:

javax.faces.view.ViewScoped

The search is not executed by a complete one, however, the edit button executes the Bean method.

I create the Session through a DAOFactory

public static DocumentoDAO criarDocumentoDAO() {
   DocumentoDAOHibernate documentoDAO  = new DocumentoDAOHibernate();
   documentoDAO.setSession(HibernateUtil.getSessionFactory().getCurrentSession());
   return documentoDAO;
}

Any suggestions on how to solve?

    
asked by anonymous 07.08.2015 / 16:33

1 answer

0

Using @RequestScoped , your data is visible only during the request. For manipulating tables on a screen, I indicate @ViewScoped , which will keep your data visible while remaining on the screen. Read more about the scope of ManagedBeans here

    
14.08.2015 / 22:39