i need to get the column values of Language Name from LangDef entity class within single dataTable from UI jsf..please let me ASAP
<p:dataTable id="dataTable" emptyMessage="#{res.NO_RECORDS_FOUND}" var="lab" value="#{labelsMB.listData}" editable="true" editMode="cell" paginator="true" rows="10" paginatorTemplate=" {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15">
<p:column headerText="#{res.CAPTION_DET}" sortBy="#{lab.captionDet}" filterBy="#{lab.captionDet}" filterMatchMode="contains" filterStyle="width: 360px;">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{lab.captionDet}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{lab.captionDet}" style="width:96%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="#{res.LABEL_NO}" sortBy="#{lab.iasLabelsPK.labelNo}" filterBy="#{lab.iasLabelsPK.labelNo}">
<p:outputLabel value="#{lab.iasLabelsPK.labelNo}" />
</p:column>
<p:column headerText="#{res.LANGUAGE_NO}" sortBy="#{lab.iasLabelsPK.langNo}" filterBy="#{lab.iasLabelsPK.langNo}" width="100">
<p:outputLabel value="#{lab.iasLabelsPK.langNo}" />
</p:column>
<p:column headerText="#{res.LANGUAGE_NAME}" sortBy="#{lab.???????}" filterBy="#{lab.?????}" width="130">
<p:outputLabel value="#{lab...?????}" />
</p:column>
</p:dataTable>
IAS_LABELS DAO entity :
public interface ILabelsDAO extends CrudRepository<IasLabels, IasLabelsPK>{
@Query List<IasLabels> findAll();
}
LabelService service class
@Service
@Transactional
public class LabelService {
static Logger logger = Logger.getLogger(LabelService.class);
@Autowired
private ILabelsDAO labelRepo;
public ILabelsDAO getLabelRepo() {
return labelRepo;
}
public void setLabelRepo(ILabelsDAO labelRepo) {
this.labelRepo = labelRepo;
}
public List<IasLabels> getAllLabels() {
if (this.getLabelRepo() != null)
return this.getLabelRepo().findAll();
return null;
}
public Iterable<IasLabels> saveData(List<IasLabels> originalValue) {
return labelRepo.save(originalValue);
}
}
LabelsMB ManagedBean implementation
@ManagedBean
@SessionScoped
public class LabelsMB {
static Logger logger = Logger.getLogger(LabelsMB.class);
List<IasLabels> labelsList = null;
@ManagedProperty(value = "#{labelService}")
private LabelService labelService;
public LabelService getLabelService() {
return labelService;
}
public void setLabelService(LabelService labelService) {
this.labelService = labelService;
}
public List<IasLabels> getListData() {
if (labelsList == null || labelsList.isEmpty()) {
if (this.getLabelService() != null) {
labelsList = this.getLabelService().getAllLabels();
}
}
return labelsList;
}
LangDef entity class
@Entity
@Table(name = "LANG_DEF")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "LangDef.findAll", query = "SELECT l FROM LangDef l"),
@NamedQuery(name = "LangDef.findByLangNo", query = "SELECT l FROM LangDef l WHERE l.langNo = :langNo"),
@NamedQuery(name = "LangDef.findByLangName", query = "SELECT l FROM LangDef l WHERE l.langName = :langName"),
@NamedQuery(name = "LangDef.findByRepExt", query = "SELECT l FROM LangDef l WHERE l.repExt = :repExt"),
@NamedQuery(name = "LangDef.findByLangDflt", query = "SELECT l FROM LangDef l WHERE l.langDflt = :langDflt"),
@NamedQuery(name = "LangDef.findByLangDir", query = "SELECT l FROM LangDef l WHERE l.langDir = :langDir"),
@NamedQuery(name = "LangDef.findByFlgSt", query = "SELECT l FROM LangDef l WHERE l.flgSt = :flgSt"),
@NamedQuery(name = "LangDef.findByLangExt", query = "SELECT l FROM LangDef l WHERE l.langExt = :langExt")})
public class LangDef implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "LANG_NO")
private Short langNo;
@Size(max = 60)
@Column(name = "LANG_NAME")
private String langName;
@Size(max = 10)
@Column(name = "REP_EXT")
private String repExt;
@Column(name = "LANG_DFLT")
private Short langDflt;
@Column(name = "LANG_DIR")
private Short langDir;
@Column(name = "FLG_ST")
private Short flgSt;
@Size(max = 10)
@Column(name = "LANG_EXT")
private String langExt;
public LangDef() {
}
public LangDef(Short langNo) {
this.langNo = langNo;
}
public Short getLangNo() {
return langNo;
}
public void setLangNo(Short langNo) {
this.langNo = langNo;
}
public String getLangName() {
return langName;
}
public void setLangName(String langName) {
this.langName = langName;
}
}
i need to get the column values of Language Name from LangDef entity class within single dataTable from UI jsf..please let me ASAP
you just need to change in your code like following
in xhtml :
Entity IasLabels :
Hope it will help to you..
edited :
you need to add following in your spring configuration file