Method not found using JPA

3

I've created a method for autocomplete. But when I am going to invoke this method the same is not found, it follows error:

    Advertência: /pessoal/cadastrar.xhtml @35,186 completeMethod="#{pessoalController.lookupFornecedores}": Method not found: br.com.constran.controller.PessoalController@278cae13.lookupFornecedores(java.lang.String)
    javax.el.MethodNotFoundException: /pessoal/cadastrar.xhtml @35,186 completeMethod="#{pessoalController.lookupFornecedores}": Method not found: br.com.constran.controller.PessoalController@278cae13.lookupFornecedores(java.lang.String)
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:109)
        at org.primefaces.component.autocomplete.AutoComplete.broadcast(AutoComplete.java:359)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:795)
        at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:936)
        at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)

Follow method in my DAO:

Interface:

List lookupSuppliers ();

DAO Implementation:

@Override
public List<Fornecedores> lookupFornecedores() {

    Query query = em.createQuery("SELECT f.razao FROM br.com.constran.modelo.Fornecedores f WHERE f.razao LIKE :fornecedor ");

    List<Fornecedores> fornecedores = query.getResultList();

    return fornecedores;
}
}

Next layer Service:

Interface:   List lookupSuppliers ();

Interface Implementation:

@Autowired
private PessoalDAO pessoalDAO;

@Override
public List<Fornecedores> lookupFornecedores() {
    List<Fornecedores> fornecedores = pessoalDAO.lookupFornecedores();
    return fornecedores;
}

The following is my method in my controller:

private Pessoal pessoal;
private List<Pessoal> pessoals;

@Autowired
private PessoalService pessoalService;

public String lookupFornecedores(){

   fornecedores = pessoalService.lookupFornecedores();

    return "";

}

Does anyone have any idea why the method is not being found?

    
asked by anonymous 12.05.2014 / 20:37

1 answer

2

Primefaces AutoComplete requires a String parameter.

In your case it should be something like: lookupFornecedores(String valorDigitado){}

    
12.05.2014 / 20:49