Hi,
I am using seam-gen generated code which is very simple class as below.
import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Out; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.intercept.BypassInterceptors; import org.jboss.seam.framework.EntityQuery; import java.util.Arrays; @Name("productList") @Scope(ScopeType.SESSION) public class ProductList extends EntityQuery<Product> { private static final String EJBQL = "select product from Product product"; private static final String[] RESTRICTIONS = { "lower(product.network) like lower(concat(#{productList.product.id},'%'))", "lower(product.source) like lower(concat(#{productList.product.source},'%'))", "lower(product.zone) like lower(concat(#{productList.product.zone},'%'))",}; private product product; public productList() { setEjbql(EJBQL); setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS)); setMaxResults(25); } public product getproduct() { return product; } }
I am displaying the list of products in a xhtml file generated by seam in table format in 7 columns which has around 30 products.
What I am observing is the getProduct() method is called hundreds of times.
Question - Why getProduct() method is called hundreds of times?
I tried to use @BypassInterceptor for getProduct() method but still it is getting called hundreds of time.
Then I tried to outject variable product by using @Out. It gave me exception org.jboss.seam.RequiredException: @Out attribute requires non-null value.
After that I tried to use @Out for getProduct() method instead of product variable. I changed the method as below
@Out (scope=ScopeType.SESSION) public Product getproduct() { if (product == null) { product = new product(); } return product; }
Now the exception is gone but getProduct() method is getting called for hundreds of times.
Question - Is outjection work in EntityQuery? or it only work in beans, SLSB, SFSB?
Can somebody help me to resolve this issue?