Hibernate Validator with JavaFX

One of the key features in Exadel Flamingo is that it allows you to use Hibernate Validator based validation on JavaFX UI side.

On the server you can have something like this:

@Entity
@Name ("message")
public class Message {
   @Id @GeneratedValue
   private Long id;
 
   @Length(min=3, max=40)
   private String text;
   ...
}

This is a simple entity and also a Seam component.

On the JavaFX side all you need to do is this:

var textBox : TextBox = TextBox {};
var errorText: String {};
...
errorText = FlamingoServiceFactory.getHessianEntityValidator().
                    validate("message.text", textBox.text);

message.text – message is Seam component name and text is component property. textBox.text is JavaFX node (widget) whose value we need to validate.

Simple… right?

Leave a Reply