EntityQuery RESTRICTIONS
waltc Nov 17, 2010 11:36 AMYes I really did check google and forum first. From what I can tell this should work.
I have a single Seam application that, depending on which tab is selected a different subset of the table corpus should be displayed. Everything else is identical.
The ejbql is a simple select compositeActivity from CompositeActivity compositeActivity
An earlier version had the where clause embedded but now I must expand.
In the action bean I added the following methods:
       public void setCondition1() {
                String restrict[] = {
                                "compositeActivity.docType = 1",
                                " compositeActivity.engineType = 0"
                };
                compositeActivityList.setRestrictionExpressionStrings(Arrays.asList(restrict));
        }
        public void setPCOndition2() {
                String restrict[] = {
                                "compositeActivity.docType = 0", 
                                " compositeActivity.engineType = 0"
                };
                compositeActivityList.setRestrictionExpressionStrings(Arrays.asList(restrict));
        }
        public void setCondition3() {
                String restrict[] = {
                                "compositeActivity.docType = 0",
                                " compositeActivity.engineType = 1"
                };
                compositeActivityList.setRestrictionExpressionStrings(Arrays.asList(restrict));
        }
        public void setCondition4() {
                String restrict[] = {
                                "compositeActivity.docType = 1",
                                " compositeActivity.engineType = 1"
                };
                compositeActivityList.setRestrictionExpressionStrings(Arrays.asList(restrict));
        }
I invoke these methods selectively in the facet definition as the tab is selected
This fails with:
Caused by: java.lang.IllegalArgumentException: there should be exactly one value binding in a restriction: org.jboss.seam.core.Expressions$1@72330de8
I guess the good news is, by virtue of the exception, my
#{DailyActivity.setCondition1()}worked.
I do not understand what it doesn't like in the restrictions itself.
Thanks,
Walt
 
    