play - 无法调用该操作,最终出现错误:java.lang.RuntimeException:java.lang.reflect.InvocationTargetException

时间:2014-10-20 23:58:29

标签: java jpa playframework playframework-2.0

[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;
    }

}

0 个答案:

没有答案