简体   繁体   中英

java bean validation 2.0 vs hibernate validator

what is difference b/w java bean validation 2.0 and hibernate validator. is both are same or different. because both look like same. can you discuss differences between java bean validation 2.0 and hibernate validator.

which one should I use in my project?

Thanks

Bean Validation 2.0 is a Java specification called JSR-380 which defines the API.

The Bean Validation api jar, eg validation-api-2.0.1.jar, contains only interfaces / annotations etc, no implementations.

Hibernate Validator (6.0.1+) is the reference implementation, and currently the only certified implementation of JSR-380.

Java specifications (JSRs) are developed under the Java Community Process (JCP). In addition to delivering a formalised specification for an API, the JSR would often include a reference implementation but other vendors are free to provide their own implementation.

Compare this with the Java Persistence API (JPA) specification JSR-317 . There are several different vendors with competing JPA implementations , including Hibernate, EclipseLink (the reference implementation for JSR-317), OpenJPA etc.

In the case of Bean Validation 2.0, there just are no competing implementations at present, just the reference implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM