Load delegate for InstanceLoader (JMix2)?

Hi all,

I am trying to use a load delegate for an instance loader in a view/screen and I think there may be a bug in the InstanceLoaderImpl. There is a check (needLoad()) if data needs to be loaded and it requires either an entityId to be set or a jpql query present, otherwise the loader returns.

My use case is like this: I want to load a certain user setting from the database and in case it does not yet exist, it should be created. So I am using a load delegate for that to return a setting-entity in any case but because of the check mentioned above, the delegate is not executed. As a workaround, I added a jpql in the descriptor with a “where 1=2” condition so it is just to circumvent the check so the delegate gets executed.

My question would be if this is a bug or if there are strong reasons that load delegates should not be used with instance loaders?

Thanks in advance!