Populate table from external dependency class


I want to populate table/grid from external java class, so I have tried the programatic creation of ds:

CollectionDatasource ds = new DsBuilder(getDsContext())

but it throws an exception at the buildCollectionDatasource.

I have also tried to populate the table from external service as discussed in this topic but the KeyValueCollectionDatasourceImpl class is not defined in my project.

All I want is to get rid of the cuba side generated queries to the external service architecture.

Any suggestions will be appreciated.


Hi Sanchit,

If you want to display data from a service, use a custom datasource class.

Regarding you question, please be more specific and provide an exception stack trace. Also, DsBuilder now has special methods for creating KeyValueDatasources, e.g. buildValuesCollectionDatasource().

Hi Konstantin,

How can I use an existence entity class, which is not in the database but defined in the external dependency to further populate table.

In a datasource, you can use only entities defined in the data model of your project. If you want to display data from external system, create an appropriate non-persistent entity, or use KeyValueEntity with ValueDatasource.