I have a perffaces data table where one column value is a foreign key. I want to display a value that is bound to a foreign key in another database table that will be displayed in this column of the data table.
issue.xhtml
<p:dataTable id="dataTable" var="issues" value="#{displayIssuesBean.issues}"
scrollable="true" style="width:1000px;" emptyMessage="#{msg['prometheus_issuesdisplayemptymessage']}">
<f:facet name="header">
<p:column headerText="#{msg['prometheus_number']}">
<h:outputText value="#{issues.id}" />
</p:column>
<p:column headerText="#{msg['prometheus_title']}">
<h:outputText value="#{issues.issueTitle}" />
</p:column>
<p:column headerText="#{msg['prometheus_type']}">
<h:outputText value="#{issues.issueType}" />
</p:column>
<p:column headerText="#{msg['prometheus_estimatedtime']}">
<h:outputText value="#{issues.estimationTime}" />
</p:column>
</p:dataTable>
In this datatable, the value of the third column ie "# {issues.issueType}" is a foreign key, I want to have the value associated with this in another table that will be displayed in this place.
I tried setting the values with another DTO along with the missing attribute and trid to set the values and get again, but didn't get the selected result.
Bean code
public List<IssueDisplayDTO> getIssueDataToForm(List<IssueDBDTO> list) {
for (int i = 0; i < list.size(); i++) {
issueDisplayDTO.setIssueNumber(list.get(i).getId());
issueDisplayDTO.setIssueType(setIssueTypeWithIssueTypeId(list.get(i).getId()));
issueDisplayDTO.setTitle(list.get(i).getIssueTitle());
issueDisplayDTO.setEstimatedTime(list.get(i).getEstimationTime());
modifiedList.add(issueDisplayDTO);
}
return modifiedList;
}
private String setIssueTypeWithIssueTypeId(int issueTypeId) {
String type=null;
if (issueTypeId == 1){
type="Bug";}
else if (issueTypeId == 2)
{type="Story";}
else if (issueTypeId == 3)
{type="Task";}
return type;
}
modifiedList , for , , .
, , ?
user1926688