我正在使用 ninja 框架,它利用 JPA 来访问数据库。
我有这个问题:在此处输入图像描述
我的代码:
public class UtenteDao extends AbstractDao {
@Inject
Provider<EntityManager> entityManagerProvider;
@UnitOfWork
public boolean utenteValido(String user, String password) {
if (user != null && password != null ) {
EntityManager entityManager = entityManagerProvider.get();
TypedQuery<Utente> q = entityManager
.createQuery("SELECT x FROM Utente x WHERE x.user = :user AND x.password = :password AND x.attivo ='true'", Utente.class)
.setParameter("user",user)
.setParameter("password",password);
Utente utente = getSingleResult(q);
if (utente != null) {
if (utente.password.equals(password)) {
return true;
}
}
}
return false;
}
}
我不知道如何解决这个问题。
我希望你能帮助我,并提前谢谢你。