public class TestBlankView extends StandardView {
@Autowired
private DataManager dataManager;
@ViewComponent
private InstanceLoader<User> userDl;
@Install(to = "userDl", target = Target.DATA_LOADER)
private User userDlLoadDelegate(final LoadContext<User> loadContext) {
var user = dataManager.load(User.class)
.query("select u from jmx2sp_User u where u.username = :username")
.parameter("username","admin")
.one();
//...
// other processes.
return user;
}
@Subscribe
public void onReady(final ReadyEvent event) {
userDl.load(); // easy to set breakpoint and debug
}
}
Current Behavior
when debugging userDl.load() and step into it, the code returns at:
if (!needLoad())
return;
Expected Behavior
When we have delegate for the loader, it should not consider query settings in XML. Because there should be a case the instance is loaded by complex query or native query(this is what I met) that is more convenient to write in Java.
Sample Project
Please see above code, simply create a blank view can reproduce the issue.
Reports that include a sample will take priority over reports that do not.
Environment
Jmix version: <2.3.4>
Bug Description
When instance data loader has no query in XML, but has delegate in controller, it will not load the data.
Steps To Reproduce
Current Behavior
when debugging
userDl.load()
and step into it, the code returns at:Expected Behavior
When we have delegate for the loader, it should not consider query settings in XML. Because there should be a case the instance is loaded by complex query or native query(this is what I met) that is more convenient to write in Java.
Sample Project
Please see above code, simply create a blank view can reproduce the issue.
Reports that include a sample will take priority over reports that do not.