I have two, kind of basic entities (A, B), with both basic attributes, both ManyToOne joined attributes.
When I want to join them in a browser, I use ValueCollectionDatasource. I tried multiple JPQL queries, which all basiclly join the 2 entities on an associated entity (they both have attribute X, which is an association).
The join happens beautifully, however when I want to reach for an associated attribute (Y) in A, I get the unfetched attribute error and I can’t for the life of me figure out how to solve it.
Maybe I can rephrase the question from a more generic aproach:
I have 2 entities (A, B). I want them to appear in one table, joined by attribute X, without creating a persistent entity with a DB table. I also need to be able to print MetaProperites, which makes it impossible to just use a ValueCollectionDatasource (afaik at least), because I can’t load an attribute (Y) into an entity, because I’ll only get the instance of Y, or the entity with attribute Y nulled. I also cannot load a MetaProperty, irrelevant of the fact that I set the related field for given MetaProperty, which closes all windows of opportinuty to actually get this to work.
Another way could be to merge 2 collectionDs into one, however I get the above mentioned error message, saying CUBA doesn’t support 2 Ds dependency.
If I understand your problem correctly, you want to display in one table two entities which have no explicit relation, and the table should also display attributes of some related entities. So let’s consider this model:
Regarding the message about inability to depend on multiple datasources. You can easily circumvent the problem if you define a dependency on a single datasource, and set the second parameter programmatically. I.e. you add ItemChangeListener to the second datasource and invoke refresh() on the dependent datasource in it, passing the current item as the second parameter.