JPQL Exception for key value collection loader on additional datastore

IntelliJ IDEA 2023.2.5 (Community Edition)
Build #IC-232.10227.8, built on November 9, 2023
Runtime version: 17.0.9+7-b1000.46 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.1.0-13-amd64
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 8
Registry:
debugger.watches.in.variables=false
debugger.new.tool.window.layout=true
ide.experimental.ui=true
io.jmix.stats.enabled=false

Jmix version 1.5.3

Non-Bundled Plugins:
com.intellij.properties.bundle.editor (232.8660.88)
org.jetbrains.kotlin (232-1.9.20-release-507-IJ10072.27)
PythonCore (232.10203.2)
io.jmix.studio (2.1.0-232)
com.haulmont.jpab (2023.3.5-232)
org.jetbrains.settingsRepository (232.9921.28)

Kotlin: 232-1.9.20-release-507-IJ10072.27
Current Desktop: KDE

I wanted to add some additional data to an entity from an additional store and changed the data collection to key value collection, but get the following JPQL exception.
The only difference is the data collection type. With normal data collection and the same query it’s working as expected.

JPQLException:
Exception Description: Problem compiling [SELECT e FROM myprj_MyEntity e].
[14, 25] The abstract schema type ‘myprj_MyEntity’ is unknown.

    <keyValueCollection id="kveDc">
        <loader id="kveDl">
            <query>
                <![CDATA[select e from myprj_MyEntity e]]>
            </query>
        </loader>
        <properties>
            <property name="myEntity" class="example.entity.MyEntity"/>
        </properties>
    </keyValueCollection>

Do you have any advice how to get around this?

The loader element of key-value data container has the store attribute. Set it if the additional data store should be used:

<keyValueCollection id="kveDc">
    <loader id="kveDl" store="mystore">
        <query>
            <![CDATA[select e from myprj_MyEntity e]]>
        </query>
    </loader>
    <properties>
        <property name="myEntity" class="example.entity.MyEntity"/>
    </properties>
</keyValueCollection>

For a key-value data container the store cannot be determined automatically by the entity type.

1 Like