Friday Apr 17, 2015

Java EE 7/Bean Validation Adoption at Harvard University

One of the most important things to do at this stage of the life-cycle of Java EE is highlight successful adoption stories. We have been doing just that for a long time through our adoption stories blog as well as JavaOne. JavaOne 2014 was particularly good in this regard and JavaOne 2015 looks to be even better. Indeed we hope the folks with great adoption stories that submitted last year but did not get accepted will resubmit next year. We will continue to highlight some of those sessions from JavaOne 2014 in the next few months. In this vein I'd like to highlight a very interesting real world story of practical usage of Bean Validation 1.1 in a Java EE 7 application at Harvard University.

Harvard University Institute for Quantitative Social Science's Dataverse application has been one of the earliest Java EE adoption use cases on GlassFish. They started with Java EE 5 and are now using Java EE 7 in the real world for a fairly complex application. The Dataverse application is an open platform for publishing, citing, analyzing, and preserving research data across universities. Although it started with Social Sciences, the application is now branching out to other fields such as Medicine and Astrophysics. The application makes full use of the Java EE stack including JSF and Bean Validation.

In their JavaOne 2014 talk project lead Gustavo Durand and senior developer Stephen Kraffmiller shared how they were sucessfully utilizing Bean validation in their Java EE 7 application. They shared some pretty advanced use cases and great practical insight. You can see their awesome JavaOne 2014 presentation below (if you are having trouble seeing the embedded video it is available here).

If you have a similarly great Java EE adoption story to share (particularly migration stories from other technologies), please do feel encouraged to share it through a JavaOne 2015 submission. The CFP deadline is April 29th, so you should hurry. In the spirit of Java EE centric vendor neutrality, what Java EE implementation or tool set you choose does not matter at all and neither does which part of the globe you are in.

Monday Jun 16, 2014

JAX-RS 2 + Bean Validation 1.1

As many of you know, JAX-RS 2 is one of the most important parts of Java EE 7. One key enhancement in JAX-RS 2 that doesn't seem to get much attention is it's integration with Bean Validation 1.1 (specifically method validation). The key significance of the enhancement is that it allows for highly declarative data validation for edge client interfaces (in fact the method validation feature introduced in Bean Validation 1.1 is valuable for WebSocket or local/EJB services for this same reason). Bhakti Mehta explains JAX-RS 2 and Bean Validation 1.1 integration well in this blog post. In addition to covering JAX-RS 2, she also discusses how Bean Validation can be used with JAX-RS 1.1. You should also check out the following excellent video by celebrated Java champion Adam Bien showing JAX-RS 2 and Bean Validation 1.1 in action using live coding with NetBeans and GlassFish:

The documentation for Jersey, the JAX-RS 2 reference implementation included in GlassFish and WebLogic, also has an excellent section on the new feature.

Wednesday Apr 09, 2014

Method Validation in Bean Validation 1.1

Although it's a point release Bean Validation 1.1 brings a number of important features to Java EE 7. Easily the most important such feature is method validation. Beyond helping enforce design-by-contract in key service layer API classes (typically implemented in EJB3 or CDI) method validation plays an important role in helping ensure valid input to remote client endpoins written in JAX-RS and WebSocket. Hardy Ferentschik of the JBoss community explains the feature well. There's also the 15-minute Bean Validation 1.1 presentation by specification lead Emmanuel Bernard on the GlassFish videos YouTube channel as well the slide deck for my own lighting talk:

If you are interested in how method validation might be used in a realistic scenario with JAX-RS and WebSocket, feel free to dig into my example application on GitHub demostrating how Java EE 7 can be used with JavaScript MV* frameworks (in this case AngularJS).

Thursday Sep 19, 2013

CDI Alignment in Bean Validation 1.1

Although it's a point release Bean Validation 1.1 brings a number of important features to Java EE 7. While the most significant of these features is clearly method validation, another very important feature is further alignment with CDI. In Java EE 6 there were a few corner cases left were Bean Validation did not work well with CDI. The most prominent of these gaps was the inability to do injection into custom constraint validators. Projects like Apache CODI and Seam 3 stepped in to fill these gaps. In Java EE 7/Bean Validation 1.1 this issue was properly addressed by making all bean validation artifacts injection officially capable. Romain Manni-Bucau of the Apache TomEE community explains the feature well in a code driven post. There's also the 15-minute Bean Validation 1.1 presentation by specification lead Emmanuel Bernard on the GlassFish videos YouTube channel:

You can also check out the very well written official specification or try things out with the Java EE 7 SDK.

Monday Aug 12, 2013

Using EL in Constraint Violation Messages with Bean Validation 1.1

Although it's a point release Bean Validation 1.1 brings a number of important features to Java EE 7. While the most significant of these features is clearly method validation, another very useful feature is the ability to customize constraint violation messages using EL. Gunnar Morling does a great job of explaining the feature in a recent blog post. There's also the 15-minute Bean Validation 1.1 presentation by specification lead Emmanuel Bernard on the GlassFish videos YouTube channel:

You can also check out the very well written official specification or try things out with the newly released Java EE 7 SDK.