Seam components isn't injected within an ExtendedDataModel child
crewman Sep 19, 2012 9:19 AMI'm trying to use a child of Seam's ExtendedDataModelClass as a data source for rich:dataTable component:
{code:xml}
<rich:dataTable id="docPackList" var="pack" width="100%" rows="25" value="#{specDocPackageList.dataModel}">
...
</rich:table>
{code}
Within this child's walk() method I call a getResultList() method of controller derived from Seam's EntityQuery. This controller has some fields injected with Seam:
{code}
@Name("specDocPackageList")
@Scope(ScopeType.CONVERSATION)
public class SpecDocPackageList extends EntityQuery<DocPackage> {
@In(create = true, value = "orgunitList")
private OrgUnitList orgUnitListController;
public OrgUnitList getOrgUnitListController() {
return orgUnitListController;
}
public void setOrgUnitListController(OrgUnitList orgUnitListController) {
this.orgUnitListController = orgUnitListController;
}
private SelectableQueryDataModel entityQueryDataModel;
@Override
public DataModel getDataModel() {
if (entityQueryDataModel == null) {
entityQueryDataModel = SelectableQueryDataModel.getInstance(this);
}
return entityQueryDataModel;
}
...
}
public class SelectableQueryDataModel<T, K> extends ExtendedDataModel {
private EntityQuery<T> dataProvider;
public SelectableQueryDataModel(EntityQuery<T> query) {
dataProvider = query;
...
}
public static SelectableQueryDataModel getInstance(EntityQuery query) {
return new SelectableQueryDataModel(query);
}
public void walk(FacesContext facesContext, DataVisitor dataVisitor, Range range, Object o) throws IOException {
...
for (T item : this.dataProvider.getResultList()) {
...
}
...
}
}
{code}
The problem is I have null in specDocPackageList.orgUnitListController when specDocPackageList.getResultList() is called from SelectableQueryDataModel.walk() method. No excpetion is thrown at that point. However, this field is injected in the right way when getResultList() method is called to get data for rich:dataTable:
{code:xml}
<rich:dataTable id="docPackList" var="pack" width="100%" rows="25"
value="#{specDocPackageList.resultList}">
...
</rich:table>
{code}
Seam 2.2.0.GA and RichFaces 3.3.3 is used.
Why doesn't Seam inject this field in the first case and do that in the second one?