0
Good guys to creating a panel where have my profile section for the Administrator who is online can see your profile information. However I am still having problems creating the profile page, I have read some tutorials and watched some video lessons, but it is still dark.
I wanted to know how to display on a page the information of a single user of the database, and in the database there are other users as well.
I know select everything and display all registered users in the bank on a page, but I really wanted to display the user information that be logged in, IE, only his.
I use one to redirect but I have no idea how to call a method that returns me data.
If you can already select all users registered in the database, I can’t see a reason not to be able to search a particular user using the login as a parameter of your query
– Weslley Tavares
because it is! the question is that my named query that I do to catch the user does not return the data
– Cícero Régis Oliveira
@Namedquery(name="User.findByid", query="select u from User u " + "Where u.login = :login")
– Cícero Régis Oliveira
DAO
public Usuario buscarUsuairoPorLogin(String login) {
 EntityManager em = EntityManagerUtil.getEM();
 try{
 System.out.println("Login: " + login);
 return (Usuario) em.createNamedQuery("Usuario.findByid")
 .setParameter("login", login)
 .getSingleResult();
 }catch (NoResultException nre){
 return null;
 }
 }
– Cícero Régis Oliveira
bean
public String dadosUsuarioCadastrado() {
 UsuarioDAO usuarioDAO = new UsuarioDAO();
 this.visualizaDadosUsuario = usuarioDAO.buscarUsuairoPorLogin(visualizaDadosUsuario.getLogin());
 return "/usuario/usuario_dadosCadastrais.xhtml";
 
}
– Cícero Régis Oliveira
Include your classes in the question itself, so it’s easier for someone to help you with the problem in question
– Weslley Tavares
can solve. It was only the eclipse that was bugged. It was enough to restart it...vlw
– Cícero Régis Oliveira
Beauty, take advantage and edit your question, the correct is
Porém todavia contudo entretanto
– user60252