Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Add myfaces-extval-core-.jar and myfaces-extval-property-validation-.jar to the classpath
  • Use JPA annotations within the model (e.g.: @Column(nullable = false) -> the field is required)

That's it!
The table below gives an overview of the validations that are generated, based on JPA annotations.

JPA Annotation

Generated validation

@Column

  • Field will be required if nullable == false.
  • If the field is a String and the columns property is set on the @Column annotation, the maximum length of the String will be validated accordingly.

@Basic

Field will be required if optional == true.

@OneToOne

Field will be required if optional == true.

@ManyToOne

Field will be required if optional == true.

(A simple demo is available here: demo_000)

...