I have two stateless session beans assortmentManager and categoryManager.
Category is a detail bean of Assortment (1:N relation).
In the inner data table the assortmentCategories list must always built up
because the reference assortmemt always changes.
Remember the JSF code
anonymous wrote :
|
| <h:dataTable var="assort" value="#{assortments}">
| <h:column>
| <h:outputLink value="">
| <h:outputText value="#{assort.description}" />
| </h:outputLink>
| <h:dataTable var="category" value="#{assortmentCategories}">
| <h:column>
| <h:outputLink value="">
| <h:outputText value="#{category.description}" />
| </h:outputLink>
| </h:column>
| </h:dataTable>
| </h:column>
| </h:dataTable>
|
|
The code of the both session beans. I need a synchronize mechanism for the list
assortmentCategories of the inner data table.
anonymous wrote :
|
| package ...;
|
| import ....;
|
| @Stateless
| @Scope(SESSION)
| @Name("assortmentManager")
| @Interceptors(SeamInterceptor.class)
| public class AssortmentManagerBean implements Serializable,
AssortmentManager {
|
| @DataModel
| private List assortments;
|
| @PersistenceContext
| private EntityManager em;
|
| @Factory("assortments")
| public void findAssortments() {
|
| assortments = em.createQuery("from Assortment a order by
a.description")
| .getResultList();
|
| }
|
| @Remove
| @Destroy
| public void destroy() {
|
| }
|
| }
|
|
The other bean
anonymous wrote :
|
| package ....;
|
| import ...;
|
| @Stateless
| @Scope(SESSION)
| @Name("categoryManager")
| @Interceptors(SeamInterceptor.class)
| public class CategoryManagerBean implements Serializable,
| CategoryManager {
|
| @DataModel
| private List assortmentCategories;
|
| @PersistenceContext
| private EntityManager em;
|
| @Factory("assortmentCategories")
| public void findCategories() {
|
| Query query = em
| .createQuery("from Category c where
c.assortment = :assortment");
| query.setParameter("assortment", assortment);
| assortmentCategories = query.getResultList();
|
| }
|
| @Remove
| @Destroy
| public void destroy() {
|
| }
|
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964357#3964357
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964357
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user