Defining the layout of elements in the UI is simple using the annotation @View. You can use , (comma) for separate properties and ; (semicolon) for new line. You can also arrangue the data within sections using {}, even you can nest sections. With the next code you obtain the above UI:
@View(members=
"year, number, date;" +
"customer { customer }" +
"data {" +
" details { details }" +
" amounts {" +
" vat { vatPercentage; vat }" +
" amountsSum { amountsSum }" +
" }" +
"}" +
"deliveries { deliveries }"
)
public class Invoice { Embedded collections are not supported by JPA 1.0, however you can use REMOVE as cascade type in your collection, and then OpenXava will generated a UI for the collections that allows you add and edit the collection elements, just as a embedded collection. Look at the example of details of Invoice:
@OneToMany (mappedBy="invoice", cascade=CascadeType.REMOVE) private Collection<InvoiceDetail> details;