I am working with jpa and to obtain this case a user through the nickname I use the following code:
@Override
public User obtenerPorNick(String nickName) {
return entityManager.find(User.class, nickName);
}
That works.
I understand that find()
is for primarykey,
What I want is to obtain a user but for another attribute, for example mail that is Unique.
What should I use ???