[error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
MODEL.USER
当我在Play 2.3.x上工作时,我想使用JPA来实现登录功能。然后我收到了这个错误。似乎验证者已经成功地从控制器接收了args。
public static User authenticate(String email, String password){
String hql = "from User u where u.email= ? and u.password= ?";
Query query = JPA.em().createQuery(hql);
query.setParameter(0, email);
query.setParameter(1, password);
User user = (User) query.getResultList();
return user;
}
Controller.User
public static class Login{
public String email;
public String password;
public String validate(){
LOG.info("validating user");
User user = User.authenticate(email, password);
if(user == null){
return "Invalid email or password";
}
LOG.info("validated Customer:"+user.toString());
return null;
}
}