-
1. Re: Session problems
fernando_jmt Jun 12, 2007 10:34 AM (in response to thierry.rietsch)You can use a page action to refresh your list (when using SESSION scope).
Like this:Stateful @Scope(ScopeType.SESSION) @Name("partsListFinder") public class PartsListFinderBean implements PartsListFinder { @In(required=false) private String plName; @DataModel private List<PartsList> partsLists; @PersistenceContext(type=PersistenceContextType.EXTENDED) private EntityManager em; public void findPartsList() { partsLists = em.createQuery("from PartsList pl where pl.name like :name") .setParameter("name", plName + '%') .getResultList(); } @Factory("partsLists") public void findPartsLists() { partsLists = em.createQuery("from PartsList").getResultList(); } public void reload(){ partsList = null; } @Destroy @Remove public void destroy() { } }
Pages.xml:<page view-id="/PartsList.xhtml" action="#{partsListFinder.reload}"> </page>
-
2. Re: Session problems
thierry.rietsch Jun 12, 2007 11:24 AM (in response to thierry.rietsch)Thank you very much, that worked wonderful. Unfortunately I ran into another problem.
I have two EJBs and two facelets. Both EJBs have a collection (named inventoryObjects) which are annoted as DataModels (@DataModel). Both EJBs are Stateful with a SESSION scope.
When I now open a facelet which works with the mentioned collection and then switch to the other facelet, I get a LazyInitializationException. This makes sense to me, because I have already a inventoryObjects collection instantiated and filled with some data from the database. How can I now avoid (beside rename all fields to different names) this problem?
thanks for your help
thierry -
3. Re: Session problems
fernando_jmt Jun 12, 2007 11:58 AM (in response to thierry.rietsch)I don't understand you very well, nevertheless I avoided the LazyInitializationException using SMPC and this in my faces-config:
<lifecycle> <phase-listener>org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener</phase-listener> </lifecycle>
-
4. Re: Session problems
pmuir Jun 12, 2007 1:28 PM (in response to thierry.rietsch)"thierry.rietsch" wrote:
beside rename all fields to different names
This is the sane solution.