Using NumberFormat decoration for percentage

Very trivial issue, I want to display input fields & table columns with % formatting (input/output mask).
Without going into custom Datatype format wanted to give a try to NumberFormat decoration.

@Column(name = "STD_DISCOUNT", precision = 10, scale = 4)
@NumberFormat(style = NumberFormat.Style.PERCENT)
protected BigDecimal stdDiscount;


@Column(name = "STD_DISCOUNT", precision = 10, scale = 4)
@NumberFormat(pattern = "0%")
protected BigDecimal stdDiscount;

The field however displays plain number:


instead of


The Spring’s formatting functionality is not used in CUBA, hence these annotations have no any effect.
But this is an interesting idea, so we’ll consider it for the future. But now you can only use custom datatypes or Formatters on the UI layer.

Thanks for prompt feedback, Konstantin.
Really hoped it wouldn’t come to custom datatypes.
Looking forward a more elegant solution in the future.

:ticket: See the following issue in our bug tracker: