javax.servlet.ServletException:HV000030:找不到类型的验证程序:java.lang.Integer [英] javax.servlet.ServletException: HV000030: No validator could be found for type: java.lang.Integer

查看:129
本文介绍了javax.servlet.ServletException:HV000030:找不到类型的验证程序:java.lang.Integer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须更新数据库中的信息。

I have to update information in my database.

FacadePatient.java 类代码:

public Patient update(Patient p) {

    Patient pat = em.find(Patient.class, p.getPatientId());
    p.setPatientPhone(pat.getPatientPhone());
    p.setPatientDateNaiss(pat.getPatientDateNaiss());
    p.setPatientEmail(pat.getPatientEmail());
    p.setPatientJob(pat.getPatientJob());
    p.setPatientSmoking(pat.getPatientSmoking());
    p.setPatientSize(pat.getPatientSize());
    em.merge(pat);
    return p;
}


推荐答案


HV000030:找不到类型的验证器:java.lang.Integer

这将在你在Hibernate Validator的味道中使用JSR303 bean验证,你在JPA实体中有一个整数 @NotEmpty c>这样的属性:

That will happen when you use JSR303 bean validation in flavor of Hibernate Validator and you have in your JPA entity the Hibernate-specific @NotEmpty on an Integer property like this:

@NotEmpty
private Integer some;

这是完全错误的。整数不能视为字符串,集合,地图或数组。请改用标准 @NotNull

This is completely wrong. An integer cannot be considered as a string, collection, map or array. Use the standard @NotNull instead.

@NotNull
private Integer some;

请注意,具体问题与JSF完全无关。将来,请通过以下方式了解如何尽可能多地排除噪音和naildown的具体问题。单独执行JPA代码。 JSF仅仅是HTTP / MVC信使,PrimeFaces只是HTML / CSS / jQuery / UI代码生成器。

Please note that the concrete problem is completely unrelated to JSF. In the future, please learn how to exclude as much as possible noise and naildown the concrete problem by e.g. executing the JPA code individually. JSF is merely the HTTP/MVC messenger here and PrimeFaces is merely the HTML/CSS/jQuery/UI code generator.

这篇关于javax.servlet.ServletException:HV000030:找不到类型的验证程序:java.lang.Integer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆