我收到“java.lang.UnsupportedOperationException:未实现延迟加载”。错误。当我对项目进行调试时,lazyModel 的构造函数正在工作,但未执行加载方法。
我的 xhtml 页面;
<p:dataTable id="envelopelistid" var="envelope"
value="#{incomingEnvelopeListController.lazyEnvelopeDataModel}"
selection="#{incomingEnvelopeListController.selectedEnvelope}" selectionMode="single"
rowKey="#{envelope.instanceIdentifier}"
sortMode="multiple"
lazy="true"
style="min-height: 300px"
paginator="true"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15"
rows="10">
我的控制器;
private LazyDataModel<Envelope> lazyEnvelopeDataModel;
public void init(){
...
lazyEnvelopeDataModel = new LazyEnvelopeDataModel(genericService,envelope);
}
我的惰性数据模型;
@Override
public List<Envelope> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
if (sortField == null) {
sortField = "identificationId";
}
datasource = genericService.getByTemplate(envelopeModel, first, pageSize, new Order(sortField, Order.convertSortOrder(sortOrder.toString())));
setRowCount((int) genericService.getCountByTemplate(envelopeModel));
return datasource;
}