Medellin Java Users Gruop is adopting Bean validation 2.0 JSR 380. Bean validation 2.0 is getting closer. Next, we posted the results of our test for Bean validation 2.0 with Java server faces JSF.
IDE: We used netbeans, jdeveloper and IntelliJ. The code was created using maven and is published on our GitHub site
Application server: WebLogic 12c, Glassfish 4.1 and Tomcat 8.5
Results: The three IDEs used worked well with Bean Validation 2.0. The code was compiled and packaged without problems.
The new annotations only work on Tomcat but with some issues.
Bean validation 2.0 is part of the new Java EE 8.0, Glassfish 4 is for Java EE 7. WebLogic 12c brings its own Bean Validation implementation for Version 1.x. WebLogic allows you to configure the apps to use a local implementation, but after a lot of time trying to do that, it didn’t work.
We tested the new annotations @NotBlank, @NotEmpty, @Email, @FutureOrPresent, @PastOrPresent, @Positive,@PositiveOrZero, @Negative and @NegativeOrZero. Some of them with some issues:
This is an image of the full test:
1. There are two different languages : @NotBlank, @NotEmpty are in Spanish, the others in English.
2. Two annotations are not showing the correct messages for the validation: @FutureOrPresent and @PastOrPresent
3. @Email validate only the input has a “@” and some text after the @; it is admitting an email that is not valid.
4. @FutureOrPresent It does not work if the year is 2017(current year) even though the month and day is in the future, but if you put a 2018 year or higher it works fine, and @PastOrPresent If you put a future date in the current year (2017) the validation is ignored.
In our test there were issues with some new annotations. We will post our results on the Hibernate JSR Forum, In the coming days we are going to test on Glassfish 5 to see if we encounter the same results.