This is a partial entities graph in my project:
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)