Browse screen is fetching more than I want

This is a partial entities graph in my project:

image

The DocVersion entity has a composition to LifeCycleEvent as shown below (note that I use cascading=All):

@Entity
public class DocVersion {
.
.
.
@Comment(“All life cycle events related to this document version.”)
@Composition
@OrderBy(“lceCreationDate”)
@OneToMany(mappedBy = “lceDov”, cascade = CascadeType.ALL)
private List dovLces = new ArrayList<>();
.
.
.
}

On the browser screen for DocVersion, the data container is shown below:

<data readOnly="true">
    <collection id="docVersionsDc"
                class="com.calidus.pdcs.entity.documents.DocVersion">
        <fetchPlan extends="_base">
            <property name="dovDoc" fetchPlan="_base"/>
        </fetchPlan>
        <loader id="docVersionsDl"/>
    </collection>
</data>

The loader is:

@Install(to = "docVersionsDl", target = Target.DATA_LOADER)
private List<DocVersion> docVersionsDlLoadDelegate(LoadContext<DocVersion> loadContext) {
    String queryStr = "select dov from Document doc " +
                      " join doc.docDovs dov ";
    String whereStr = " where dov.dovLcs <> :ssp ";
    String orderByStr = " order by doc.docCode, dov.dovId ";
    String fullQueryStr;
    // Query all entries
    if (this.showSuperseded) {
        fullQueryStr = queryStr + orderByStr;
        return dataManager.load(DocVersion.class)
                .query(fullQueryStr)
                .list();
    }
    // Query filtering superseded entries
    fullQueryStr = queryStr + whereStr + orderByStr;
    return dataManager.load(DocVersion.class)
            .query(fullQueryStr)
            .parameter("ssp", LifeCycleState.LCS_SUPERSEDED)
            .list();
}

Due to performance reasons, I don´t want the browser to load the life cycle events for each document version when building the page. So, the fetch plan does not specify the property for the mentioned composition.

The problem is that is it loading the life cycle events together with the document version, regardless of what I do. I have tried the fetch plan to extend both “_local” and “_instanceName” built-in fetch plans but with the same results.

How can I prevent it from loading the life cycle events?

Jmix version: 1.6.0
Jmix Studio plugin version: 2.1.3-231
IntelliJ version: IntelliJ IDEA 2023.1.5 (Community Edition)

Hi,

Could you please attach a demo project that reproduces the issue so it will be easier to investigate?

Regards,
Gleb

Thanks for the prompt response, Gleb.

I attached a project focusing on the problem.
Just go to “Document Versions” on the application menu and click on he only existing record.
The application will stop at a breakpoint and if you inspect the variable “docVersion” you will see it has an instance of LifeCycleEvent attached to it, despite that not being defined in the fetch plan.
I hope that helps.

FetchIssueProject.zip (2.1 MB)

Hi,

Unfortunately, I cannot start your project. It looks like a have no permissions to modify files inside it, e.g.:

> Failed to create parent directory '/Users/gorelov/Downloads/FetchIssueProject/build' when creating directory '/Users/gorelov/Downloads/FetchIssueProject/build/resources/main/META-INF'

Could you please generate project archive using gradlew zipProject task?

Regards,
Gleb