Boa noite comunidade GUJ. Queria saber como faço para pesquisar na tabela pelo nome, eu já consigo pesquisar por id mas pelo nome dar erro.
Exception do erro Exception in thread “main” java.lang.IllegalArgumentException: Provided id of the wrong type. Expected: class java.lang.Integer, got class java.lang.String at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:189) at com.exemplo.repositorio.RepositorioCliente.findByNome(RepositorioCliente.java:32) at com.exemplo.testes.Teste.main(Teste.java:21)
pesquisa por nome
public Cliente findByName(String nome){
em.getTransaction().begin();
Cliente cliente = em.find(Cliente.class, nome);
em.getTransaction().commit();
emf.close();
return cliente;
}
desde já agradeço pela ajuda!