I have a Play 2.0 template with the following first lines:
@(item: Option[Item] = None,
violations: java.util.Set[ConstraintViolation[Item]] = new util.HashSet[ConstraintViolation[Item]]())
@import java.util
@import javax.validation.ConstraintViolation
But the ConstraintViolation cannot be found and I get the error:
not found: type ConstraintViolation
The bean validation API itself is available in the application since I can use it in a controller. What can I do to import it in my template?
Either use the fully-qualified name, i.e.
@(item: Option[Item] = None,or add to your general template imports in Build.scala, like this:violations: java.util.Set[javax.validation.ConstraintViolation[Item]] = new util.HashSet[javax.validation.ConstraintViolation[Item]]())