DataManager loader bug?

I have a problem. When I load entity(s) via dataManager.load I get all related entities (in a one-to-many relationship) even if they are not in the fetch plan.

For example:

  val reports =  dataManager

Query returns “templates” in entities.

This bug causes problems with entity updates.


Hi Marcin,

I suppose you are talking about entities from the Reports add-on.

Most probably the related entities are loaded because you access a getter and lazy loading comes into play.
Consider the following test case:

private UnconstrainedDataManager dataManager;
private EntityStates entityStates;

void loadReports() {
	List<Report> reports = dataManager.load(Report.class)
	for (Report report : reports) {
		assertTrue(entityStates.isLoaded(report, "name"));
		assertFalse(entityStates.isLoaded(report, "templates")); // not loaded

		report.getReportTemplates(); // lazy loading occurs here
		assertTrue(entityStates.isLoaded(report, "templates")); // loaded