How can I validate a unique constraint with Wicket? Because only the value of 
an input field is passed to onValidate(IValidatable validatable), there is no 
chance to check if this value belongs to a specific object to update or if it 
would violate a unique constraint when creating a new object. onValidate would 
need another paremeter for the related object.

I see two possibilities:

a) Use a form validator and get the related model object from the form.

b) Pass the related object to the constructor of the Validator. I'm not sure, 
if the validator would be recreated any time the model object changes.

I would prefer a validator tied to the field and not to the form, because that 
would be more intuitive.

Another idea is to use existing JPA annotations. @Column(unique=true) is 
already there but not used for validation (outside the database). Perhaps there 
is a way to use this annotation. I really like the domain level validation of 
Grails: http://grails.org/doc/1.1/guide/7.%20Validation.html

How would you validate a unique constraint with wicket?

Thanks in advance
Christian





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to