Feb 29th, 2012, 10:40 AM
Annotation Validation - Add vs Update
Hi all, still pretty new to Spring and had a question about using annotated validation. I was able to write my own contraint on a property named "sportName" that checks to see if it already exists in the database or not, if it does tell the user it already exists. This works great when adding new sports, however if I try to edit a sport but keep the sportName the same, it returns an error as well.
Is it possible to pass in a sportID (or any parameter for that matter) in my custom constraint for sportName so that the validator won't return false if sportName is already in the database but the sportID matches the currently sportID currently being edited?
Or is there a better way of doing this?
Tags for this Thread