Issue: Query conditional by reference properties in Main Store and Additional Stores

Hi Team,

In application we use :Main Store and Additional Stores.
Entity 1: “Contract” belong to Main Store;
Entity 2: “Company” belong to Additional Stores;
The “Contract” entity has one property “company” type MANY_TO_ONE reference to Company ;

@SystemLevel
@Column(name = "COMPANY_ID")
private UUID companyId;

@DependsOnProperties({"companyId"})
@JmixProperty
@Transient
private Company company;

On Contract browse, we show list of contracts with Data Container:“contractsDc” with data loader query:
select e from main_Contract e where e.company.name = 'FPT’

But error show as following error:

*Local Exception Stack: *
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.7.9.6-jmix): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [select e from main_Contract e

  •                where e.company.name = 'FPT']. *
    

[38, 51] The state field path ‘e.company.name’ cannot be resolved to a valid type.

  • at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:157)*
  • at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:349)*
  • at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:280)*
  • at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:165)*
  • at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:144)*
  • at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:118)*
  • at org.eclipse.persistence.internal.jpa.EJBQueryImpl.(EJBQueryImpl.java:104)*
  • at org.eclipse.persistence.internal.jpa.EJBQueryImpl.(EJBQueryImpl.java:88)*

I know this problem here because reference cross multi datastore in difference database.
But do you have any solution to resolve this issue. Please help us!

Hello,

I do apologize for the late reply.
JPQL query works within a single datastore only, so e.company cannot be used in it but e.companyId can.
For example, you can create an entityComboBox with Companies, subscribe to its ValueChangeEvent and set query parameter for e.companyId = :idParam condition like shown in query condition documentation section.

Best regards,
Dmitry