Using javax.validation
The code has reference to net.sf.oval
validators that are not used by the services.
64a8e983 demonstrates use of Bean Validation 1.1.0 API in services:
import javax.validation.Valid;
import org.springframework.validation.annotation.Validated;
...
@Validated
public <T extends Dimension<?>> T save(@Valid T dimension) {
LOG.debug("Persisting dimension {}", dimension);
return dimensionRepository.save(dimension);
}
When implementing new service methods please use @Valid
on model arguments where applicable.
Models use
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
...
@NotNull
@Size(max = 100)
@Column(length = 100, unique = true, nullable = false)
private String name;