07 Januar 2009

Public Review of JSR-303 Bean Validation Started

You can find the spec on the JSR page.

Because Bean Validation will have impact on how validation is done in Java EE it contains a section about integration in JPA 2.0. There will several changes related to the DDL generation. See the extract of this proposal:

The list of constraints that must be understood by persistence providers are as followed:
  • @NotNull should be considered equivalent to @Column(nullable=false) / @JoinColumn(nullable=false)
  • @Size.max should be considered equivalent to @Column.length for String properties
  • @Digits (which contains integer and fraction) should be considered equivalent to @Column.precision = integer+fraction, @Column.scale = fraction for decimal columns
Persistence Provider should optionally recognize and try to apply the following constraints as well:
  • @Min / @Max on numeric columns (TODO String too?)
  • @Future / @Past on temporal columns
  • @Size for collections and array (not sure it is feasible)
JPA 2.0 will become even better!

Keine Kommentare: