Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
545 views
in Technique[技术] by (71.8m points)

jakarta ee - javax.servlet.ServletException: HV000030: No validator could be found for type: java.lang.Integer

I have to update information in my database.

FacadePatient.java class code:

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;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

HV000030: No validator could be found for type: java.lang.Integer

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;

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;

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...