2 Replies Latest reply on Jan 30, 2009 9:02 AM by Lawrence Li

    Getting error - "there should be exactly one value binding in a restriction"

    Lawrence Li Newbie

      This is probably something simple to correct, but I can't figure it out.  The following query fails with the exception below:



      <framework:entity-query name="userShoppingtripsQuery"
                ejbql="select userShoppingtrips from User user JOIN user.shoppingtrips userShoppingtrips"
                order="purchasedate">
                <framework:restrictions>
                     <value>user.username = #{identity.username}</value>
                     <value>userShoppingtrips.disabled=false</value>
                </framework:restrictions>
           </framework:entity-query>




      Caused by: javax.el.ELException: /shoppingTrip.xhtml @24,63 rendered="#{empty userShoppingtripsQuery.resultList}": Error reading 'resultList' on type org.jboss.seam.framework.EntityQuery_$$_javassist_6
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
           at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:390)
           ... 67 more
      Caused by: java.lang.IllegalArgumentException: there should be exactly one value binding in a restriction: org.jboss.seam.core.Expressions$1@2b8f443d
           at org.jboss.seam.framework.Query.parseEjbql(Query.java:226)
           at org.jboss.seam.framework.EntityQuery.createQuery(EntityQuery.java:169)
           at org.jboss.seam.framework.EntityQuery.initResultList(EntityQuery.java:73)
           at org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:65)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
           at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
           at org.jboss.seam.framework.EntityQuery_$$_javassist_6.getResultList(EntityQuery_$$_javassist_6.java)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
           at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
           at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
           at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
           at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
           at org.jboss.el.parser.AstEmpty.getValue(AstEmpty.java:29)
           at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
           ... 68 more



      However, the following query runs without error:



      <framework:entity-query name="userShoppingtripsQuery"
                ejbql="select userShoppingtrips from User user JOIN user.shoppingtrips userShoppingtrips WHERE userShoppingtrips.disabled=false"
                order="purchasedate">
                <framework:restrictions>
                     <value>user.username = #{identity.username}</value>
                </framework:restrictions>
           </framework:entity-query>