How To Create Embedded or Nested Datasources

I’m having an issue with nested and embedded classes/data sources at run time. The xml is below which works fine in most cases but at run time a new item in the collection is added and the nested datasource is always null.

        <collectionDatasource id="shipmentsDs"
            <datasource id="shipToContactDs"
                <datasource id="shipToContactContactDs"
                <datasource id="shipToContactAddressDs"

I found I can programmatically create the nested datasource (shipToContact) but having trouble creating the two under the it. Each is an embedded class. Not sure if these should be embedded or nested, tried both

Here is the code to build the initial datasource under the collection datasource
Datasource ds = new DsBuilder(getDsContext())

Datasource dsAddrs = new DsBuilder(getDsContext())

One of the errors I received is metaProperty required (or something like that) I haven’t been been able to find what either meta property or property actually requires.

Any help would be appreciated. An example would be great!


I worked out an alternate way to accomplish what I needed


If you’re using CUBA 7, we’d recommend you switching to Data Containers and Data Loaders instead of using datasources, see Data Components - CUBA Platform. Developer’s Manual