0

When I add a new Category, I use a CategoryDTO class, which contains a parameter friendlyUrl validated by @FriendlyURL validator:

    @FriendlyURL(exists = false, message = "error.friendly.url.already.exists")
    private String friendlyUrl;

When I update the Category I want to use the same CategoryDTO with @FriendlyURL validator but now with options `exists=true' and message = "error.friendly.url.not.found"

    @FriendlyURL(exists = true, message = "error.friendly.url.not.found")

Is this possible or should I create a new DTO for the update method?

vdruta
  • 77
  • 2
  • 5
  • Did you try using *Validation Groups*? See http://stackoverflow.com/questions/35704351/spring-rest-controller-how-to-selectively-switch-off-validation – Ali Dehghani May 22 '16 at 19:01
  • @AliDehghani I have just read the documentation from top to bottom on Grouping constraints and I can't find a way to do what I want. – vdruta May 22 '16 at 19:47

0 Answers0