Table NestedContainerProperty not refreshed when original property changes

Hello community,

I have two mysql tables in a one-to-many relationship which I represent with two table components in a Vaadin 7.3.4 UI, using JPA and eclipselink.

@Entity
@Table(name="productpackages")
@NamedQuery(name="ProductPackage.findAll", query="SELECT s FROM ProductPackage s")
public class ProductPackage implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(unique=true, nullable=false)
    private int id;
    public int getId() {
        return this.id;
    }
    public void setId(int id) {
        this.id = id;
    }

    @Column(name="est_sales_qty", nullable=false)
    private int estSalesQty;
    public int getEstSalesQty() {
        return this.estSalesQty;
    }
    public void setEstSalesQty(int estSalesQty) {
        this.estSalesQty = estSalesQty;
    }
}

@Entity
@Table(name="packinglist")
@NamedQuery(name="PackingList.findAll", query="SELECT s FROM PackingList s")
public class PackingList implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(unique=true, nullable=false)
    private int id;
    public int getId() {
        return this.id;
    }
    public void setId(int id) {
        this.id = id;
    }
    @Column(nullable=false)
    private int price;
    public int getPrice() {
        return this.price;
    }
    public void setPrice(int price) {
        this.price = price;
    }

    //bi-directional many-to-one association to ProductPackage
    @ManyToOne
    @JoinColumn(name="packageid", nullable=false)
    private ProductPackage productpackage;
        public ProductPackage getProductpackage() {
        return this.productpackage;
    }
    public void setProductpackage(ProductPackage productpackage) {
        this.productpackage = productpackage;
    }

    @Transient
    private BigDecimal priceTotal;
    public BigDecimal getPriceTotal() {
        return productpackage.getEstSalesQty().multiply(new BigDecimal(this.price));
    }
}

In Vaadin,
Table 1 is bound to
productpackages
. Displays columns
id
and
estSalesQty

Table 2 is bound to
packinglist
. Displays columns
id
,
price
,
estSalesQty
and
priceTotal
. estSalesQty added to Table2 container with addNestedContainerProperty.

Issue is when I change
estSalesQty
with a form bound to the selected row in
Table1
, I see the change reflected immediately in the
Table1 estSalesQty column
, however the
Table2 estSalesQty and priceTotal columns
are not changed. I can see the new values reflected in Table2 only when I refresh the browser.

I have tried adding a valuechangelistener to the textfield for estSalesQty in the form, and called table2.refreshRowCache() as well as table2Container.refresh(). Did not make any changes (other than slowing down the app). Debugging shows that productpackage.getEstSalesQty() returns the old value no matter what.

Any help appreciated pointing the right direction to solve the issue.

Thanks

Note: estSalesQty is BigDecimal, not int. It’s a typo I made while preparing the sample entity to illustrate the issue.