如何避免both query and delegate are null这个错误

不用aaaDl.setQuery();这个方法,直接使用service类中方法获取到的实体集合,给数据容器赋值,出现both query and delegate are null这个错误,请问如何避免这个错误

这个问题是因为dl的自动加载引起的。你可以设置 XML 中的 dataLoadCoordinator 不自动加载:

<dataLoadCoordinator auto="false"/>

或者,如果界面中有其他dl需要自动加载的话,可以删除单个DC里面的dl。因为你的DC数据是手动加载的,就不需要有dl了。

使用这个属性后,使用过滤器的时候,还是会报both query and delegate are null这个错误

这个错的的根源是加载器既没有设置query也没有设置delegate。根据报错的加载器逐个修复就可以。filter里面也设置了 dataLoader,可以设置过滤器的 autoApply="false",避免自动加载。

好的,谢谢