Join multiple tables in a single screen

Hello,

In my project, I have 2 additional MySQL datastore “Publisher” and “Account”. Each datastore has couple of columns.
ex:- Publisher has publisher_site and Account has account

I have posted a similar question regarding joining the “publisher_site” & “account” tables in one screen. For this approach I am using valueCollectionDatasource as suggested here:
Please refer to this question: [url=]https://www.cuba-platform.com/discuss/t/addingdispalying-column-from-another-entity[/url]

Further, I am getting an error while compiling JPQL query with join statement. The JPA fail to locate the entities when compiling the query. I have found out that the entity classes were missing in the persistence.xml file. So, I added the entity tables which I want to join but then studio generated duplicate data model tables.
Ex:- two publisher_site tables, one refers to the additional datastore and the other to the main datastore.
I think the reason why the tables were not shown in the persistence file is because it comes from the additional datastore.

I have tried the similar approach on a sample project ‘orderManagement’ but still got the same compiling exception. I have a feeling that I’m doing something wrong.
It would be really helpful if CUBA team can provide me a running example for the similar approach.

Last question: Is it possible to add additional views which are created from MySQLWorkbench in studio?

Thanking in advance.

Hello,

Please attach a sample project where the problem with JPQL compiling is reproduced.

Hi Olga,

Can you provide me the e-mail address

info@cuba-platform.com

You can also zip the project using the zipProject gradle task and attach it here in comments.

Hi Olga,

I have send an e-mail.

Hi Sanchit, could you please attach DB scripts for your additional datastores.

Hi Olga,

Please check the email.

Thanks.

Hi Sanchit,

I would suggest the following solution: create a service that extracts entities from additional datastores and returns a collection of KeyValueEntities; then use this collection in a CustomValueCollectionDatasource to display values in dataGrid. In this case, you don’t need to modify persistence.xml.

The main point here is to explicitly set the datastore name for ValueLoadContext, as far as it uses the main datastore by default.

You can find an example of such service in CUBA Labs repository.

I hope it will help.

This seems to work only on legacy version. How can we achieve the same in the latest cuba version?