DataGrid Sort issues

I stumbled upon a strange situation. On only one screen, column sorting doesn’t work for most of my columns.

Exception and Stacktrace:

java.lang.ClassCastException: class org.eclipse.persistence.indirection.ValueHolder cannot be cast to class org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder (org.eclipse.persistence.indirection.ValueHolder and org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder are in unnamed module of loader ‘app’)
at io.jmix.eclipselink.impl.lazyloading.AbstractValueHolder.(AbstractValueHolder.java:56)
at io.jmix.eclipselink.impl.lazyloading.CollectionValuePropertyHolder.(CollectionValuePropertyHolder.java:44)
at io.jmix.eclipselink.impl.lazyloading.JpaLazyLoadingListener.processCollectionValueHolder(JpaLazyLoadingListener.java:121)
at io.jmix.eclipselink.impl.lazyloading.JpaLazyLoadingListener.processValueHolders(JpaLazyLoadingListener.java:106)
at io.jmix.eclipselink.impl.lazyloading.JpaLazyLoadingListener.afterEntityLoad(JpaLazyLoadingListener.java:72)
at io.jmix.core.datastore.DataStoreAfterEntityLoadEvent.sendTo(DataStoreAfterEntityLoadEvent.java:78)
at io.jmix.core.datastore.AbstractDataStore.fireEvent(AbstractDataStore.java:343)
at io.jmix.core.datastore.AbstractDataStore.loadList(AbstractDataStore.java:156)
at io.jmix.core.impl.UnconstrainedDataManagerImpl.loadList(UnconstrainedDataManagerImpl.java:112)
at io.jmix.ui.model.impl.CollectionLoaderImpl._load(CollectionLoaderImpl.java:92)
at io.jmix.ui.model.impl.CollectionLoaderImpl.load(CollectionLoaderImpl.java:75)
at io.jmix.ui.model.impl.CollectionContainerSorter.sort(CollectionContainerSorter.java:55)
at io.jmix.ui.component.data.datagrid.ContainerDataGridItems.sort(ContainerDataGridItems.java:178)
at io.jmix.ui.component.datagrid.SortableDataGridDataProvider.sort(SortableDataGridDataProvider.java:37)
at io.jmix.ui.component.impl.AbstractDataGrid.onSort(AbstractDataGrid.java:403)
at jdk.internal.reflect.GeneratedMethodAccessor452.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:709)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:399)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:363)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1216)
at com.vaadin.ui.Grid.sort(Grid.java:5043)
at com.vaadin.ui.Grid.setSortOrder(Grid.java:5023)
at com.vaadin.ui.Grid.access$400(Grid.java:145)
at com.vaadin.ui.Grid$GridServerRpcImpl.sort(Grid.java:660)
at jdk.internal.reflect.GeneratedMethodAccessor451.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:153)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:115)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:442)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:407)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:275)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:83)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at io.jmix.core.impl.logging.LogMdcFilter.doFilterInternal(LogMdcFilter.java:28)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:337)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:106)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:97)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:147)
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:112)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:221)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)

Screen Descriptor:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window" xmlns:dynattr="http://jmix.io/schema/dynattr/ui"
        xmlns:cuba="http://schemas.haulmont.com/cuba/screen/compatibility"
        caption="msg://allPOs.caption"
        focusComponent="purchaseOrdersTable"
<data readOnly="true">
        <collection id="purchaseOrdersDc"
                    class="com.company.deiproductconfig2.entity.purchase.PurchaseOrder">
            <fetchPlan extends="_local">
                <property name="signedBy" fetchPlan="_instance_name"/>
                <property name="verifiedBy" fetchPlan="_instance_name"/>
                <property name="buyer" fetchPlan="_instance_name"/>
                <property name="billTo" fetchPlan="_instance_name"/>
                <property name="shipTo" fetchPlan="_instance_name"/>
                <property name="shipVia" fetchPlan="_instance_name"/>
                <property name="outgoingShipVia" fetchPlan="_instance_name"/>
                <property name="fob" fetchPlan="_instance_name"/>
                <property name="supplier" fetchPlan="_instance_name"/>
                <property name="vendor" fetchPlan="_instance_name"/>
                <property name="poType"/>
                <property name="recLogEntries" fetchPlan="_instance_name">
                    <property name="dateShipped"/>
                </property>
                <property name="revisedFrom" fetchPlan="_instance_name"/>
                <property name="dateShippedFromRecLogs"/>
            </fetchPlan>
            <loader id="purchaseOrdersDl">
                <query>
                    <![CDATA[select e from deiproductconfig2$PurchaseOrder e]]>
                </query>
            </loader>
        </collection>
    </data>
    <dialogMode height="600"
                width="800"/>
    <layout expand="purchaseOrdersTable"
            spacing="true">
        <cuba:cubaFilter id="filter"
                         applyTo="purchaseOrdersTable"
                         dataLoader="purchaseOrdersDl">
            <properties include=""
                        includeProperties="+,billTo.business,shipTo.business,supplier.business,vendor.business"
                        excludeProperties="poNumber"/>
            <custom name="PO NumberWRevs" caption="PO Number w/ Revs" paramClass="java.lang.Integer">
                <![CDATA[FUNCTION('FLOOR', {E}.poNumber) = ?]]></custom>
            <custom name="assembledDetailProduct" caption="Assembled Detail Product"
                    paramClass="com.company.deiproductconfig2.entity.config1.product.assembled.PackDieProd2"
                    join="join deiproductconfig2$AsmPODet asmPoDetProdSearchAsmPoDet ON (asmPoDetProdSearchAsmPoDet.assemblyPo.id = {E}.id)
                    left join asmPoDetProdSearchAsmPoDet.product asmPoDetProdSearchProdVer
                    left join asmPoDetProdSearchProdVer.product2 asmPoDetProdSearchProd">
                asmPoDetProdSearchProd.id = ?
            </custom>
            <custom name="assembledDetailProductVersion" caption="Assembled Detail Prod. Ver."
                    paramClass="com.company.deiproductconfig2.entity.config1.product.assembled.PackProdVer"
                    join="join deiproductconfig2$AsmPODet asmPoDetProdVerSearchAsmPoDet ON (asmPoDetProdVerSearchAsmPoDet.assemblyPo.id = {E}.id)
                    left join asmPoDetProdVerSearchAsmPoDet.product asmPoDetProdVerSearchProdVer">
                asmPoDetProdVerSearchProdVer.id = ?
            </custom>
            <custom name="assembledDetailWaferType" caption="Assembled Detail Wafer Type"
                    paramClass="com.company.deiproductconfig2.entity.config1.wafertype.WaferType"
                    join="join deiproductconfig2$AsmPODet asmPoDetProdVerWaferTypeSearchAsmPoDet ON (asmPoDetProdVerWaferTypeSearchAsmPoDet.assemblyPo.id = {E}.id)
                    left join asmPoDetProdVerWaferTypeSearchAsmPoDet.product asmPoDetProdVerWaferTypeSearchProdVer
                    left join asmPoDetProdVerWaferTypeSearchProdVer.waferType2 asmPoDetProdVerWaferTypeSearchWaferTYpe">
                asmPoDetProdVerWaferTypeSearchWaferTYpe.id = ?
            </custom>
            <custom name="waferDetailWaferType" caption="Wafer Detail Wafer Type"
                    paramClass="com.company.deiproductconfig2.entity.config1.wafertype.WaferType"
                    join="join deiproductconfig2$WaferPODet waferPoDetWaferTypeSearchWaferPoDet ON (waferPoDetWaferTypeSearchWaferPoDet.waferPo.id = {E}.id)
                    left join waferPoDetWaferTypeSearchWaferPoDet.waferType waferPoDetWaferTypeSearchWaferType">
                waferPoDetWaferTypeSearchWaferType.id = ?
            </custom>
            <custom name="diceDetailWaferType" caption="Dice Detail Wafer Type"
                    paramClass="com.company.deiproductconfig2.entity.config1.wafertype.WaferType"
                    join="join deiproductconfig2$DicePODet dicePoDetWaferTypeSearchDicePoDet ON (dicePoDetWaferTypeSearchDicePoDet.dicePo.id = {E}.id)
                    left join dicePoDetWaferTypeSearchDicePoDet.waferLot dicePoDetWaferTypeSearchWaferLot
                    left join dicePoDetWaferTypeSearchWaferLot.waferType dicePoDetWaferTypeSearchWaferType">
                dicePoDetWaferTypeSearchWaferType.id = ?
            </custom>
            <custom name="servDetailWaferType" caption="Service Detail Wafer Type"
                    paramClass="com.company.deiproductconfig2.entity.config1.wafertype.WaferType"
                    join="join deiproductconfig2$WServPODet servPoDetWaferTypeSearchServPoDet ON (servPoDetWaferTypeSearchServPoDet.wServicePo.id = {E}.id)
                    left join servPoDetWaferTypeSearchServPoDet.waferLot servPoDetWaferTypeSearchWaferLot
                    left join servPoDetWaferTypeSearchWaferLot.waferType servPoDetWaferTypeSearchWaferType">
                servPoDetWaferTypeSearchWaferType.id = ?
            </custom>
            <custom name="servDetailProd" caption="Service Detail Product"
                    paramClass="com.company.deiproductconfig2.entity.config1.product.assembled.PackDieProd2"
                    join="join deiproductconfig2$PServPODet servPoDetProdSearchServPoDet ON (servPoDetProdSearchServPoDet.aServicePo.id = {E}.id)
                    left join servPoDetProdSearchServPoDet.assembledProductLot servPoDetProdSearchProdLot
                    left join servPoDetProdSearchProdLot.productVersion servPoDetProdSearchProdVer
                    left join servPoDetProdSearchProdVer.product2 servPoDetProdSearchProd">
                servPoDetProdSearchProd.id = ?
            </custom>
            <custom name="servDetailProdVer" caption="Service Detail Prod. Ver."
                    paramClass="com.company.deiproductconfig2.entity.config1.product.assembled.PackProdVer"
                    join="join deiproductconfig2$PServPODet servPoDetProdSearchServPoDet ON (servPoDetProdSearchServPoDet.aServicePo.id = {E}.id)
                    left join servPoDetProdSearchServPoDet.assembledProductLot servPoDetProdSearchProdLot
                    left join servPoDetProdSearchProdLot.productVersion servPoDetProdSearchProdVer">
                servPoDetProdSearchProdVer.id = ?
            </custom>
            <custom name="servDetailService" caption="Service Detail Service"
                    paramClass="com.company.deiproductconfig2.entity.business.supplier.service.Service"
                    join="join deiproductconfig2$ServPODet servPoDetServSearchServPoDet ON (servPoDetServSearchServPoDet.purchaseOrder.id = {E}.id)
                    left join servPoDetServSearchServPoDet.service servPoDetServSearchServ">
                servPoDetServSearchServ.id = ?
            </custom>
        </cuba:cubaFilter>
        <treeDataGrid id="purchaseOrdersTable"
                      width="100%"
                      dataContainer="purchaseOrdersDc"
                      selectionMode="MULTI" hierarchyProperty="revisedFrom" sortable="true">
            <actions>
                <action id="edit" type="edit">
                    <properties>
                        <property name="openMode" value="NEW_TAB"/>
                    </properties>
                </action>
                <action id="remove" type="remove"/>
                <action id="print" trackSelection="true"/>
                <action id="printTba" trackSelection="true"/>
                <action id="copy" caption="Copy" trackSelection="true"/>
                <action id="revise" caption="Revise" trackSelection="true"/>
                <action id="editPoNumber" caption="Edit PO Number" trackSelection="true"/>
            </actions>
            <columns>
                <column id="viewDetails" sortable="false"
                        collapsible="false" caption="" width="70">
                    <componentRenderer/>
                </column>
                <column id="poNumber" property="poNumber"/>
                <column id="poType" property="poType"/>
                <column id="dateShippedFromRecLogs" property="dateShippedFromRecLogs"/>
                <column id="dateReceivedFromRecLogs" property="dateReceivedFromRecLogs"/>
                <column id="numberOfShipments" property="numberOfShipments"/>
                <column id="createDate" property="createDate"/>
                <column id="datePromised" property="datePromised"/>
                <column id="onTime" property="onTime"/>
                <column id="notes" width="100px" property="notes">
                    <htmlRenderer/>
                </column>
                <column id="supplier" property="supplier"/>
                <column id="vendor" property="vendor"/>
                <column id="revisionNotes" property="revisionNotes"/>
                <column id="engineeringPo" property="engineeringPo"/>
                <column id="revised" property="revised"/>
                <column id="closed" property="closed"/>
                <column id="singleProductFromLines"
                        caption="msg://com.company.deiproductconfig2.entity.purchase/AssemblyPo.singleProductFromLines">
                    <htmlRenderer nullRepresentation="null"/>
                </column>
                <column id="singleWaferTypeFromLines"
                        caption="msg://com.company.deiproductconfig2.entity.purchase/WaferPo.singleWaferTypeFromLines">
                    <htmlRenderer nullRepresentation="null"/>
                </column>
                <column id="recLogEntries" property="recLogEntriesString">
                    <htmlRenderer/>
<!--                    <renderer type="com.haulmont.cuba.gui.components.DataGrid$HtmlRenderer"/>-->
                </column>
            </columns>
            <simplePagination/>
            <buttonsPanel id="buttonsPanel"
                          alwaysVisible="true">
                <popupButton id="createButton" caption="Create...">
                    <actions>
                        <action id="tr"
                                caption="msg://com.company.deiproductconfig2.entity.purchase/TapeAndReelPo"/>
                        <action id="assembly"
                                caption="msg://com.company.deiproductconfig2.entity.purchase/AssemblyPo"/>
                        <action id="dice"
                                caption="msg://com.company.deiproductconfig2.entity.purchase/DicePO"/>
                        <action id="service"
                                caption="msg://com.company.deiproductconfig2.entity.purchase/ServicePo"/>
                        <action id="wafer"
                                caption="msg://com.company.deiproductconfig2.entity.purchase/WaferPo"/>
                        <action id="general"
                                caption="msg://com.company.deiproductconfig2.entity.purchase/PurchaseOrder"/>
                    </actions>
                </popupButton>
                <button id="editBtn" action="purchaseOrdersTable.edit"/>
                <button id="removeBtn" action="purchaseOrdersTable.remove"/>
                <button id="copyButton"
                        action="purchaseOrdersTable.copy"/>
                <button id="reviseButton"
                        action="purchaseOrdersTable.revise"/>
                <popupButton id="printPopupButton"
                             caption="Print...">
                    <actions>
                        <action id="printPo"
                                caption="PO"
                                enable="false"/>
                        <action id="printOpenPo"
                                caption="Open PO"
                                enable="false"/>
                    </actions>
                </popupButton>
            </buttonsPanel>
        </treeDataGrid>
        <hbox id="lookupActions" spacing="true" visible="false">
            <button action="lookupSelectAction"/>
            <button action="lookupCancelAction"/>
        </hbox>
    </layout>
    <facets>
        <dynattr:dynamicAttributes/>
    </facets>
</window>

The controller seemingly is not the cause as the behavior persists even with an empty controller.

The entities in question are a parent class and five child classes that extend it. Most of the properties on the above screen are from the parent class so here is a spinnet of that:

@JmixEntity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "DEIPRODUCTCONFIG2_PURCHASE_ORDER", indexes = [
    Index(name = "IDX_DEIPRODUCTCONFIG2_PURCHASE_ORDER_UNQ", columnList = "PO_NUMBER", unique = true),
    Index(name = "IDX_DEIPRODUCTCONFIG2_SUPPLIER", columnList = "SUPPLIER_ID")
])
@Entity(name = "deiproductconfig2\$PurchaseOrder")
open class PurchaseOrder : StandardEntity() {
    @JmixProperty
    @Column(name = "PO_NUMBER")
    var poNumber: Double? = null

...
}

This screen is a combined browser screen for all 6 entities. Interestingly, the browsers screens for each subtype do sort correctly.

Help?

The plot thickens! While debugging I found it is this relationship causing the problem:

@OnDeleteInverse(DeletePolicy.DENY)
    @OnDelete(DeletePolicy.DENY)
    @JoinTable(
        name = "DEIPRODUCTCONFIG2_TAPE_AND_REEL_PO_CUSTOMER_ORDER_DETAIL_LINK",
        joinColumns = [JoinColumn(name = "CUSTOMER_ORDER_DETAIL_ID")],
        inverseJoinColumns = [JoinColumn(name = "TAPE_AND_REEL_PO_ID")]
    )
    @ManyToMany
    var tapeAndReelPoes: MutableList<TapeAndReelPo> = NotInstantiatedList()
        get
        set

and

@JoinTable(
        name = "DEIPRODUCTCONFIG2_TAPE_AND_REEL_PO_CUSTOMER_ORDER_DETAIL_LINK",
        joinColumns = [JoinColumn(name = "TAPE_AND_REEL_PO_ID")],
        inverseJoinColumns = [JoinColumn(name = "CUSTOMER_ORDER_DETAIL_ID")]
    )
    @ManyToMany()
    var orderLines: MutableList<CustomerOrderDetail> = NotInstantiatedList()

TapeAndReelPo is one of the children mentioned above.

What is interesting is that it works when I change the attribute definition to:

@JoinTable(
        name = "DEIPRODUCTCONFIG2_TAPE_AND_REEL_PO_CUSTOMER_ORDER_DETAIL_LINK",
        joinColumns = [JoinColumn(name = "TAPE_AND_REEL_PO_ID")],
        inverseJoinColumns = [JoinColumn(name = "CUSTOMER_ORDER_DETAIL_ID")]
    )
    @ManyToMany()
    var orderLines: MutableList<CustomerOrderDetail> = ArrayList()

For whatever reason it doesn’t like the NotInstantiatedList() object.

I don’t have time to put together a sample project/proof-of-concept at this time. But I wanted to report back my findings.

Hello Weston,

Thank you for your efforts and reporting

The problem is caused by lazy loading mechanism. Something goes wrong during value holders processing.

NotInstantiatedList was been designed to solve another issue: in case of using standard collections as field initializers Eclipselink considers them as already loaded properties and (re)loads these fields eagerly.

By using ArrayList instead of NotInstantiatedList you just disabled lazy loading for this field and problem does not occur anymore. But orderLines will be loaded eagerly in every place where this entity loaded.

It seems that the same solution may be achieved by just adding problem attributes into screen fetch plan.

Unfortunately I cannot suggest more precise solution without seeing and debugging some reproducible example of the problem.

Regards,
Dmitry

I was not able to add the problem attribute to the fetch plan, because it is an attribute in a child class (TapeAndReelPO). The screen is searching for objects in the parent class (PurchaseOrder), which necessarily includes all of the children. But there is no way to include properties of the child class in my fetch plan.