How have I to call the categoryManager bean. I should call method before the data model is loaded into the table. With the following construction
xhtml @69,119 binding="#{categoryMangager.updateAssortmentCategories}": Target Unreachable, identifier 'categoryMangager' resolved to null
<h:dataTable var="category" binding="#{categoryMangager.updateAssortmentCategories}" value="#{assortmentCategories}">
<h:column>
<h:outputLink value="">
<h:outputText value="#{category.description}" />
</h:outputLink>
</h:column>
</h:dataTable>
@Stateful
@Scope(SESSION)
@Name("categoryManager")
@Interceptors(SeamInterceptor.class)
public class CategoryManagerBean implements Serializable, CategoryManager {
...
public void updateAssortmentCategories() {
if (assortment != oldAssortment) {
Query query = em.createQuery("from Category c where c.assortment = :assortment");
query.setParameter("assortment", assortment);
assortmentCategories = query.getResultList();
oldAssortment = assortment;
}
}
...
}
You don't want to use the binding attribute with Seam. Consider using the Factory pattern for your use case. If you need the update to occur for each refresh of the page I would suggest using a stateless scope.