I am introducing the BeanValidation constraints in my entities, and am finding that the constraint @Size associated to a List is not being detected. Have even included the group UiCrossFieldChecks.class just in case. But now working either.
@Size(message = "Al menos registrar una seccion", min = 1, groups = UiCrossFieldChecks.class)
@OnDeleteInverse(DeletePolicy.UNLINK)
@OnDelete(DeletePolicy.CASCADE)
@OneToMany(mappedBy = "modeloContrato", cascade = CascadeType.ALL)
protected List<Seccion> secciones = new ArrayList<Seccion>();
Entity attribute constraints defined by annotations like @Size, @NotNull, etc. are added to a UI component that represents the corresponding entity attribute in an editor screen. Since the Table component has no validators, @Size is ignored. For instance, if you represent a collection attribute with a field component like TokenList, then validation will be successfully triggered:
The UiCrossFieldChecks group is used when validating class-level constraints on entity editor commit, e.g.:
In order to resolve your issue, I would recommend either create class-level constraint (see doc) or implement the validateAdditionalRules method in the entity editor.