Parent Copy

Child entities can obtain parent values using @Copy:

public class LineItemLogic {

@Formula("productPrice * qtyOrdered")
public void deriveAmount() { }

@ParentCopy("product.price")
public void deriveProductPrice() { }
}

In this example, a LineItem obtains the Product's Price.  Unlike a formula parent reference, subsequent changes to the parent value are not cascaded to the child objects.  This provides a useful semantic; here, for example, use of the @ParentCopy means that orders placed on Monday do not reflect price changes made on Tuesday.

Comments