OpenXava 3.0.1: Hibernate Validator Support
OpenXava is a JPA Application Engine. You put in your JPA classes and, in exchange, you obtain a full-featured application ready for production, and without code generation. Since OpenXava 3.0.1, which was released this week, Hibernate Validator is fully supported.
So now you can write a Java class like this:
@Entity
@IdClass(DrivingLicenceKey.class)
public class DrivingLicence {
@Id @Column(length=2) @Stereotype("NO_FORMATING_STRING")
private String type;
@Id @Max(2)
private int level;
@Column(length=40) @Required
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
And you will have an application module as this one:
Note that we are using @Max, a Hibernate Validator constraint, on our property level:
@Id @Max(2)
private int level;
Therefore, when the user tries to save the driving lincence @Max constraint will be enforced, and the validation message will be shown to the user if it fails.
What's new in 3.0.1?
- Hibernate Validator full support. Messages thrown by Hibernate Validator are shown to the user as validation messages.
- @Required, @PropertyValidator and @EntityValidator redefined as Hibernate Validator constraints.
- Max size of textAreaEditor uses Javascript for control max size (even with Ctrl-V).
- Action 'new' of CRUD put the view to the initial section.
- Ant creation wizard on template projects asks for the project name. Now it's not needed edit the ant build files.
- A lot of fixes. Look at changelog.
Learn more on OpenXava site.
Download this new version from SourceForge.
| Attachment | Size |
|---|---|
| driving-licence.jpg | 12.54 KB |
- Login or register to post comments
- 3433 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)









