2 Replies Latest reply on May 9, 2008 8:47 PM by Tiago Sudeval

    Problem with new method in EntityHome ( not method found )

    Tiago Sudeval Newbie

      Hi,
      I have a class RecursoHome that extends EntityHome


      @Name("recursoHome")
      public class RecursoHome extends EntityHome<Recurso> {    
              private static final long serialVersionUID = 1L;        
              @RequestParameter 
          Long recursoId;
          
          @Override
          public Object getId() 
          { 
              if (recursoId==null)
              {
                  return super.getId();
              }
              else
              {
                  return recursoId;
              }
          }        
              
          @Override 
          @Begin(join=true)
          public void create() {
              super.create();
          }
          
          @SuppressWarnings("unchecked")
              public List<Recurso> autocomplete(Object text){
              return getEntityManager().createQuery("select recurso from Recurso recurso " +
                              "WHERE recurso.descricao LIKE '%"+text+"%'").getResultList();
          }
      }



      I create a method autocomplete , but when i use the method  in View layer i get a error. ( recurso.xhtml )
      for example:


      suggestionAction = #{recursoHome.autocomplete}




      Error:


      Exception during request processing:
      Caused by javax.servlet.ServletException with message: "/recurso.xhtml @41,30 suggestionAction="#{recursoHome.autocomplete}": Method not found: br.com.company.nameSystem.controller.RecursoHome@764091.autocomplete(java.lang.Object)"



      EntityHome and Home methods like persist(), update(), remove() not return anyone problem...


      Someone knows the reason ?





      sorry my english :) (i´m improving )

        • 1. Re: Problem with new method in EntityHome ( not method found )
          Tiago Sudeval Newbie

          No problem to persist


          <h:commandButton id="save"
                                    value="Cadastrar"
                                   action="#{recursoHome.persist}"
                                 rendered="#{!recursoHome.managed}"/><h:commandButton id="save"
                                    value="Cadastrar"
                                   action="#{recursoHome.persist}"
                                 rendered="#{!recursoHome.managed}"/>


          but in recursoHome.autocomplete i have problem



          <rich:suggestionbox id="suggestionBoxRecurso"
                               var="recurso"
                               for="text"
                               fetchValue="#{recursoHome.instance.descricao}"
                               suggestionAction="#{recursoHome.autocomplete}"
                               minChars="4"
                               height="50"
                                   width="250">
                               <h:column>
                                   <h:outputText value="#{recurso.descricao}" />
                               </h:column>                     
                              </rich:suggestionbox>

          • 2. Re: Problem with new method in EntityHome ( not method found )
            Tiago Sudeval Newbie

            problem solved, i think that was problem with Eclipse and cache of old sources :(