Child entities in a GroupTable

Hi,
We have a different child entities which we want to render in GroupTable.
There is parent entity A. And entities B, С which extends A. All entities A, B and С are stored in a different tables. So we should to display B and C in GroupTable.
What is the best practice?

For the moment we use List of KeyValueEntity to get all entities B and C. We use java reflection to get all fields of B (or C) and combine with parent fields. Then we get form DB all values. This approach is complex and it can impact on original filtering and pagination. Is’n it? Will we have problems with filtering and pagination?

If you need to display all the fields of all entities of the hierarchy in a single UI table, maybe just put all these fields into a single entity and don’t use the hierarchy at all?

If it’s not an option, create a DB view and map it to a separate read-only entity.

Hi,

  1. As for “put all fields into a single entity”, it complicate our validation and it seems is not our approach.
  2. Could you please explain approach with DB view?

Sure.

  • Create a database view that joins all your tables. You can add an SQL script for this to 30.create-db.sql and to an update script if needed.
  • In Studio, create an entity, set your view in the “Table” field and select the “DB view” checkbox.
  • Create browse screen for the entity.
  • If you need to open editors from this browser, override the edit action and open an appropriate edit screen depending of the entity type using ScreenBuilders.