Hi all, I have an EntityQuery component declared like that:
@Name("invoices") | public class InvoicesQuery extends EntityQuery { | | private String compName; | private static final String[] restrictions = { | "lower(i.company.name) like lower(#{invoices.compName} + '%')"}; | | @Override | protected String getCountEjbql() { | return "select count(*) from Invoice i"; | } | | @Override | public String getEjbql() { | return "from Invoice i join fetch i.company"; | } | | @Override | public Integer getMaxResults() { | return 30; | } | | @Override | public List<String> getRestrictions() { | return Arrays.asList(restrictions); | } | | .. | .. | .. | } PROBLEM: When I try to read the resultCount property I get the following error: javax.faces.FacesException: javax.el.ELException: /almoxarifado/selmaterial.xhtml @33,55 rendered="#{materiais.resultCount > 0}": Error reading 'resultCount' on type com.rmemoria.almoxarifado.MateriaisQuery_$$_javassist_21 | at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:373) | at javax.faces.component.UIComponent.encodeAll(UIComponent.java:880) | at javax.faces.render.Renderer.encodeChildren(Renderer.java:137) | at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:809) | at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886) | at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892) | at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571) | at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108) | at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:233) | at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106) | at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) | at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144) | at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:70) | at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:60) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56) | at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56) | at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56) | at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:293) | at org.jboss.seam.web.AbstractAjax4jsfFilter.doFilter(AbstractAjax4jsfFilter.java:35) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56) | at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:56) | at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:127) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127) | at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) | at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) | at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) | at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241) | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) | at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580) | at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) | at java.lang.Thread.run(Unknown Source) | Caused by: javax.el.ELException: /almoxarifado/selmaterial.xhtml @33,55 rendered="#{materiais.resultCount > 0}": Error reading 'resultCount' on type com.rmemoria.almoxarifado.MateriaisQuery_$$_javassist_21 | at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76) | at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:370) | ... 50 more | Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [el1] | at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:176) | at org.jboss.seam.framework.EntityQuery.setParameters(EntityQuery.java:176) | at org.jboss.seam.framework.EntityQuery.createCountQuery(EntityQuery.java:165) | at org.jboss.seam.framework.EntityQuery.initResultCount(EntityQuery.java:103) | at org.jboss.seam.framework.EntityQuery.getResultCount(EntityQuery.java:95) | at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) | at java.lang.reflect.Method.invoke(Unknown Source) | at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) | at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57) | at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) | at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:33) | at org.jboss.seam.util.Work.workInTransaction(Work.java:38) | at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:28) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) | at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69) | at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103) | at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151) | at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87) | at com.rmemoria.almoxarifado.MateriaisQuery_$$_javassist_21.getResultCount(MateriaisQuery_$$_javassist_21.java) | at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) | at java.lang.reflect.Method.invoke(Unknown Source) | 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:64) | 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.AstGreaterThan.getValue(AstGreaterThan.java:21) | at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) | at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71) | ... 51 more | Caused by: org.hibernate.QueryParameterException: could not locate named parameter [el1] | at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:75) | at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:81) | at org.hibernate.impl.A | 18:09:41,390 ERROR [STDERR] bstractQueryImpl.determineType(AbstractQueryImpl.java:413) | at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:383) | at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:171) | ... 84 more I have to override getCountEjbql() to avoid another problem when using join fetch in the Ejbql. But the method getCountEjbql() requires the HQL declaration with the restrictions rendered. SUGESTION: Why doesn't change getCountEjbql() to return only the main query like in getEjbql(), and during rendering of the query, the EntityQuery includes the restrictions? Otherwise I'll have to test all the restrictions to include in the getCountEjbql. Regards, Ricardo Memória View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057507#4057507 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057507 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user