2 Replies Latest reply on Oct 28, 2008 1:30 PM by scott duke

    ConvertEntity on Search

    scott duke Novice

      I posted this once before a few weeks ago and made a couple of mistakes when I posted. Sorry about the previous errors. Hopefuly, someone has a solution to this.


      I upgraded my seam to version jboss-seam-2.1.0-SNAPSHOT taken on 10/13/08.


      I have designed my search/listing similar to that described in the Seam in Action book. This particular has multiple convertEntity and a single convertEnum. When I apply the convertEntity and convertEnum to my EditionEdit.xhtml, everything works fine. However, when used in the EditionList.xhtml, the convertEnum works, but the convertEntity keeps giving me the following error:



      13:31:05,638 WARN  [SeamPhaseListener] uncaught exception, passing to exception handler
      javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch
           at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
           at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
           at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
           at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
           at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
           at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
           at org.jboss.seam.core.Expressions$1.setValue(Expressions.java:117)
           at org.jboss.seam.navigation.Pages.applyConvertedValidatedValuesToModel(Pages.java:840)
           at org.jboss.seam.navigation.Pages.postRestore(Pages.java:439)
           at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:546)
           at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:392)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:228)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           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:432)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.IllegalArgumentException: argument type mismatch
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
           at java.lang.reflect.Method.invoke(Unknown Source)
           at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
           ... 56 more
      13:31:05,748 ERROR [CachedConnectionValve] Application error: Faces Servlet did not complete its transaction
      13:31:06,654 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jboss-seam-excel.jar!/META-INF/seam-excel.taglib.xml
      13:31:06,670 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jboss-seam-mail.jar!/META-INF/seam-mail.taglib.xml
      13:31:06,670 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jboss-seam-pdf.jar!/META-INF/seam-pdf.taglib.xml
      13:31:06,685 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jboss-seam-rss.jar!/META-INF/seam-rss.taglib.xml
      13:31:06,685 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/s.taglib.xml
      13:31:06,701 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
      13:31:06,701 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
      13:31:06,701 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
      13:31:06,717 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
      13:31:06,732 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
      13:31:06,732 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/a4j.taglib.xml
      13:31:06,748 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/ajax4jsf.taglib.xml
      13:31:06,748 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/jsp.taglib.xml
      13:31:06,764 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/rich.taglib.xml
      13:31:06,779 ERROR [STDERR] Oct 21, 2008 1:31:06 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
      INFO: Added Library from: jar:file:/C:/jboss/jboss-4.2.2.GA/server/default/deploy/artwork.ear/artwork.war/WEB-INF/lib/richfaces-ui.jar!/META-INF/richfaces.taglib.xml
      



      EditionList.xhtml


      <ui:define name="body">
          
          <h:form id="editionSearch" styleClass="edit">
          
              <rich:simpleTogglePanel label="Edition Search Parameters" switchType="ajax"> 
                                              
                   <s:decorate id="itemDecoration" template="layout/display.xhtml">
                      <ui:define name="label">Item</ui:define>               
                        <h:selectOneMenu id="item"
                                   styleClass="selectOneMenu"                  
                                      value="#{itemHome.itemId}">
                             <s:selectItems value="#{itemList.resultList}" var="_item" label="#{_item.name}" 
                                               itemValue="#{_item.id}" noSelectionLabel=" "/>
                             <a:support event="onblur" reRender="itemDecoration" ajaxSingle="true" bypassUpdates="true"/>
                        </h:selectOneMenu>
                   </s:decorate>
                           
                   <s:decorate id="mediumDecoration" template="layout/display.xhtml">
                      <ui:define name="label">Medium</ui:define>               
                        <h:selectOneMenu id="codeMedium"
                                   styleClass="selectOneMenu"
                                      value="#{editionList.edition.medium}">
                             <s:selectItems value="#{codeList.mediumCodes}" var="_codeMedium" label="#{_codeMedium.code}"
                                               noSelectionLabel=" "/>
                             <s:convertEntity />
                        </h:selectOneMenu>
                   </s:decorate> 
                                        
                   <s:decorate id="limitedDecoration" template="layout/display.xhtml">
                      <ui:define name="label">Limited</ui:define>               
                        <h:selectOneMenu id="limitedBooleanType"
                                   styleClass="selectOneMenu"
                                          value="#{editionList.edition.limited}">
                             <s:selectItems value="#{codeList.booleanTypes}" var="_booleanType" label="#{_booleanType.value}" 
                                               noSelectionLabel=" "/>
                             <s:convertEnum />
                        </h:selectOneMenu>
                   </s:decorate>
            
              </rich:simpleTogglePanel>
              
              <div class="actionButtons">
                  <h:commandButton id="search" value="Search" action="/EditionList.xhtml"/>
              </div>
              
          </h:form>
          
              
          <rich:panel>
              <f:facet name="header">Edition Search Results</f:facet>       
                <ui:include src="EditionTable.xhtml">
                   <ui:param name="editionFrom" value="EditionList"/>
               </ui:include>        
          </rich:panel>
          
          <s:div styleClass="actionButtons" rendered="#{empty from}">
              <s:button id="done" 
                     value="Create Edition"
                      view="/EditionEdit.xhtml">
                  <f:param name="editionId"/>                
              </s:button>                 
          </s:div>
          
      </ui:define>
      



      EditionList.java


      @Name("editionList")
      public class EditionList extends EntityQuery<Edition>
      {
           private static final long serialVersionUID = -311723806447384135L;
      
           private static final String[] RESTRICTIONS = {
                "edition.item.id = #{itemHome.itemId}",
                "edition.medium = #{editionList.edition.medium}",
                "edition.limited = #{editionList.edition.limited}",
                };
      
           private Edition edition = new Edition();
           
           
           public EditionList() {
                Code medium = new Code();
                edition.setMedium(medium);
           }
           
      
           @Override
           public String getEjbql() {
              return "select edition from Edition edition";
           }
           
           @Override
           public Integer getMaxResults() {
                return 25;
           }
      
           public Edition getEdition() {
                return edition;
           }
           
           @Override
           public List<String> getRestrictionExpressionStrings() {
                return Arrays.asList(RESTRICTIONS);
           }
           
           @Override
           public String getOrder() {
                if (super.getOrder() == null) {
                     setOrder("item.description asc");
                }
                return super.getOrder();
           }   
           
      }
      



      EditionList.page.xml


      <page xmlns="http://jboss.com/products/seam/pages"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
            
         <param name="firstResult" value="#{editionList.firstResult}"/>
         <param name="editionListOrder" value="#{editionList.order}"/>
         <param name="from"/>
         <param name="item" value="#{editionList.edition.item}"/>   
         <param name="medium" value="#{editionList.edition.medium}"/>
         <param name="limited" value="#{editionList.edition.limited}"/> 
      
      </page>
      



      It seems that the error is thrown on the medium param.


      If I make changes to pass the id rather than the entity, there is not any error, but the SQL does not use the restriction.


      EditionList.xhtml


                   <s:decorate id="mediumDecoration" template="layout/display.xhtml">
                      <ui:define name="label">Medium</ui:define>               
                        <h:selectOneMenu id="codeMedium"
                                   styleClass="selectOneMenu"
                                      value="#{editionList.edition.medium.id}">
                             <s:selectItems value="#{codeList.mediumCodes}" var="_codeMedium" label="#{_codeMedium.code}"
                             itemValue="#{_codeMedium.id}"
                                               noSelectionLabel=" "/>
                        </h:selectOneMenu>
                   </s:decorate> 
      



      EditionList.page.xml


         <param name="firstResult" value="#{editionList.firstResult}"/>
         <param name="editionListOrder" value="#{editionList.order}"/>
         <param name="from"/>
         <param name="item" value="#{editionList.edition.item}"/>   
         <param name="medium" value="#{editionList.edition.medium.id}"/>
         <param name="limited" value="#{editionList.edition.limited}"/> 
      



      EditionList.java


      @Name("editionList")
      public class EditionList extends EntityQuery<Edition>
      {
           private static final long serialVersionUID = -311723806447384135L;
      
           private static final String[] RESTRICTIONS = {
                "edition.item.id = #{itemHome.itemId}",
                "edition.medium.id = #{editionList.edition.medium.id}",
                "edition.limited = #{editionList.edition.limited}",
                };
      
           private Edition edition = new Edition();
           
           
           public EditionList() {
                Code medium = new Code();
                edition.setMedium(medium);
           }
           
      
           @Override
           public String getEjbql() {
              return "select edition from Edition edition";
           }
           
           @Override
           public Integer getMaxResults() {
                return 25;
           }
      
           public Edition getEdition() {
                return edition;
           }
           
           @Override
           public List<String> getRestrictionExpressionStrings() {
                return Arrays.asList(RESTRICTIONS);
           }
           
           @Override
           public String getOrder() {
                if (super.getOrder() == null) {
                     setOrder("item.description asc");
                }
                return super.getOrder();
           }   
           
      }
      






      My questions are:


      1. Am I missing something in my code to get the convertEntity to work?
      2. The getRestrictions method was changed to use getRestrictionExpressionStrings method. If I were to pass the id, how do I add this to my restriction list? Before I updated seam, the getRestrictions was being called every time I pressed the search button, but with the getRestrictionExpressionStrings method, it is not being called each time. This leads me to believe either something else changed, I am using the wrong method to add more restrictions or I am not using the param correctly.
      3. If neither convertEntity nor passing the id is the proper way, then what would work?


      Any and all comments would be appreciated. I am sure someone out there has encountered this problem and has a solution.



      Scott


        • 1. Re: ConvertEntity on Search
          scott duke Novice

          Ok... I have figured out a solution. It might not be pretty or the right way, but it works. If someone has any other suggestions or changes, feel free to reply.


          First I would like to state that I have 2 solutions. Both are rather straight forward. The one I was most interested in resolving was the one where I have an entity called Code.java.


          There are multiple types of codes. In this situation there are 2 types: medium and edition. Medium will display its own list containing: lith and paper. Edition will display its own list containing: RE, ME, AP.


          There is another component on here called Item. This one is solved using the other way.


          EditionList.xhtml


                       <s:decorate id="itemDecoration" template="layout/display.xhtml">
                          <ui:define name="label">Item</ui:define>               
                            <h:selectOneMenu id="item"
                                       styleClass="selectOneMenu"                  
                                          value="#{itemHome.itemId}">
                                 <s:selectItems value="#{itemList.resultList}" var="_item" label="#{_item.name}" 
                                                   itemValue="#{_item.id}" noSelectionLabel=" "/>
                                 <a:support event="onblur" reRender="itemDecoration" ajaxSingle="true" bypassUpdates="true"/>
                            </h:selectOneMenu>
                       </s:decorate>
                               
                       <s:decorate id="mediumDecoration" template="layout/display.xhtml">
                          <ui:define name="label">Medium</ui:define>               
                            <h:selectOneMenu id="codeMedium"
                                       styleClass="selectOneMenu"
                                          value="#{editionList.edition.medium.id}">
                                 <s:selectItems value="#{codeList.mediumCodes}" var="_codeMedium" label="#{_codeMedium.code}"
                                                   itemValue="#{_codeMedium.id}" noSelectionLabel=" "/>
                            </h:selectOneMenu>
                       </s:decorate> 
                       
                       <s:decorate id="editionDecoration" template="layout/display.xhtml">
                          <ui:define name="label">Edition</ui:define>               
                            <h:selectOneMenu id="codeEdition"
                                       styleClass="selectOneMenu"
                                          value="#{editionList.edition.edition.id}">
                                 <s:selectItems value="#{codeList.editionCodes}" var="_codeEdition" label="#{_codeEdition.code}"
                                                   itemValue="#{_codeEdition.id}" noSelectionLabel=" "/>
                            </h:selectOneMenu>
                       </s:decorate>              
                                            
                       <s:decorate id="limitedDecoration" template="layout/display.xhtml">
                          <ui:define name="label">Limited</ui:define>               
                            <h:selectOneMenu id="limitedBooleanType"
                                       styleClass="selectOneMenu"
                                              value="#{editionList.edition.limited}">
                                 <s:selectItems value="#{codeList.booleanTypes}" var="_booleanType" label="#{_booleanType.value}" 
                                                   noSelectionLabel=" "/>
                                 <s:convertEnum />
                            </h:selectOneMenu>
                       </s:decorate>
          



          EditionList.page.xml


             <param name="firstResult" value="#{editionList.firstResult}"/>
             <param name="editionListOrder" value="#{editionList.order}"/>
             <param name="from"/>
             <param name="item" value="#{editionList.edition.item}"/>   
             <param name="medium" value="#{editionList.edition.medium.id}"/>
             <param name="edition" value="#{editionList.edition.edition.id}"/>
             <param name="limited" value="#{editionList.edition.limited}"/> 
          



          EditionList.java


          @Name("editionList")
          public class EditionList extends EntityQuery<Edition>
          {
               private static final long serialVersionUID = -311723806447384135L;
          
               private static final String[] RESTRICTIONS = {
                    "edition.item.id = #{itemHome.itemId}",
                    "edition.medium.id = #{editionList.edition.medium.id}",
                    "edition.edition.id = #{editionList.edition.edition.id}",
                    "edition.limited = #{editionList.edition.limited}",
                    };
          
               private Edition edition = new Edition();
               
               
               public EditionList() {
                    Code mediumCode = new Code();
                    edition.setMedium(mediumCode);
                    Code editionCode = new Code();
                    edition.setEdition(editionCode);          
               }
               
          
               @Override
               public String getEjbql() {
                  return "select edition from Edition edition";
               }
               
               @Override
               public Integer getMaxResults() {
                    return 25;
               }
          
               public Edition getEdition() {
                    return edition;
               }
               
               @Override
               public List<ValueExpression> getRestrictions()
               {
                    List<String> expressionStrings = Arrays.asList(RESTRICTIONS);
                    
                    Expressions expressions = new Expressions();
                     List<ValueExpression> restrictionVEs = new ArrayList<ValueExpression>(expressionStrings.size());
                     for (String expressionString : expressionStrings)
                     {
                        restrictionVEs.add(expressions.createValueExpression(expressionString));
                     }
                     //setRestrictions(restrictionVEs);          
                  return restrictionVEs;
               }
                 
               /*
               @Override
               public List<String> getRestrictionExpressionStrings() {
                    return Arrays.asList(RESTRICTIONS);
               }
               */
               
               @Override
               public String getOrder() {
                    if (super.getOrder() == null) {
                         setOrder("item.description asc");
                    }
                    return super.getOrder();
               }   
               
          }
          




          • 2. Re: ConvertEntity on Search
            scott duke Novice

            Here is an update to my EditionList.java



            @Name("editionList")
            public class EditionList extends EntityQuery<Edition> {
                 private static final long serialVersionUID = -311723806447384135L;
            
                 private static final String[] RESTRICTIONS = {
                           "lower(edition.item.name) like concat(lower(#{editionList.edition.item.name}),'%')",          
                           "edition.medium.id = #{editionList.edition.medium.id}",
                           "edition.edition.id = #{editionList.edition.edition.id}",
                           "edition.limited = #{editionList.edition.limited}", };
            
                 private Edition edition = new Edition();
            
                 public EditionList()
                {
                      Item item = new Item();
                      edition.setItem(item);
                      Code mediumCode = new Code();
                      edition.setMedium(mediumCode);
                      Code editionCode = new Code();
                      edition.setEdition(editionCode);
                      this.setMaxResults(25);
                    this.setEjbql("select edition from Edition edition");
                    this.setOrder("item.description asc");
                    this.setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
                } 
                 
                 public Edition getEdition() {
                      return edition;
                 }
            
            }