Hello!

        Thanks, Bill! You are absolutely right!

P.S. Dear developers, can You look at f:convertNumber for BigDecimal improvements?

Bill Schneider wrote:
Hello!

What does this error mean:

/pages/admin/references/services/edit.xhtml @72,0 value="#{serviceform.periodicService.price}": Exception setting property price of base with class ru.tagnet.beans.references.services.PeriodicService

It ocurred what I use
<f:convertNumber pattern="#{bundle['formats.currency.2d']}"/>
on h:inputText. formats.currency.2d == #,##0.00 and input field is of class java.math.BigDecimal


Hi Boris,
Check your server error logs to see if there is more detail from an underlying exception.

My guess is, f:convertNumber isn't playing nicely with the setter for BigDecimal, and there is a ClassCastException or NoSuchMethodException somewhere.

You could change your getter/setter to take/return a java.lang.Number instead, for example

private BigDecimal price;
public Number getPrice() {
  return price;
}
public void setPrice(Number n) {
  if (n instanceof BigDecimal)
    price = (BigDecimal) n;
  } else {
    price = new BigDecimal(n.doubleValue());
  }
}

that way, if the convert tries to pass in a Double instead, it gets converted in your setter.

hope this helps,

-- Bill
With respect,
        Boris

Reply via email to