The EntityApplicationModel class serves as the base for the application. Its main purpose is to hold references to the root EntityModel instances used by the application.
When extending this class you must provide a constructor with a single EntityConnection parameter, as seen below.
public class StoreApplicationModel extends SwingEntityApplicationModel {
public StoreApplicationModel(EntityConnection connection) {
super(connection, List.of(createCustomerModel(connection)));
}
private static SwingEntityModel createCustomerModel(EntityConnection connection) {
CustomerModel customerModel =
new CustomerModel(connection);
CustomerAddressModel customerAddressModel =
new CustomerAddressModel(connection);
customerModel.detail().add(customerAddressModel);
//populate the model with rows from the database
customerModel.tableModel().items().refresh();
return customerModel;
}
}