I have the following table:
<p:dataTable id="tabelaDisciplinasSelelecionadas" var="disciplina" value="#{disciplinaBean.droppedDisciplinas}"
rendered="#{not empty disciplinaBean.droppedDisciplinas}">
<p:column headerText="Id">
<h:outputText value="#{disciplina.idDisciplina}" />
</p:column>
<p:column headerText="Nome">
<h:outputText value="#{disciplina.nomeDisciplina}"/>
</p:column>
<p:column headerText="Código">
<h:outputText value="#{disciplina.codigoDisciplina}" />
</p:column>
<p:column headerText="Vagas">
<h:outputLabel for="vagas" value="Vagas: " />
<p:spinner id="vagas" value="#{editalDisciplinaBean.editalDisciplina.vagas}" />
</p:column>
<p:column style="width:32px">
<p:commandButton update=":formDisciplina:display" oncomplete="PF('disciplinaDialog').show()" icon="ui-icon-search">
<f:setPropertyActionListener value="#{disciplina}" target="#{disciplinaBean.disciplinaSelecionada}" />
</p:commandButton>
</p:column>
</p:dataTable>
EditalDisciplinaBean.java
ManagedBean(name="editalDisciplinaBean")
@SessionScoped
public class EditalDisciplinaBean {
private EditalDisciplina editalDisciplina;
private EditalDisciplinaDAO editalDisciplinaDAO = new EditalDisciplinaDAO();
private List<EditalDisciplina> lista;
private List<EditalDisciplina> listaFiltro;
private Edital edital;
private Disciplina disciplina;
public EditalDisciplina getEditalDisciplina() {
if (editalDisciplina == null)
editalDisciplina = new EditalDisciplina();
return editalDisciplina;
}
public void setEditalDisciplina(EditalDisciplina editalDisciplina) {
this.editalDisciplina = editalDisciplina;
}
public EditalDisciplinaDAO getDisciplinaDAO() {
return editalDisciplinaDAO;
}
public void setDisciplinaDAO(EditalDisciplinaDAO disciplinaDAO) {
this.editalDisciplinaDAO = disciplinaDAO;
}
public List<EditalDisciplina> getLista() {
if (lista == null)
lista = editalDisciplinaDAO.getListaEditalDisciplina();
return lista;
}
public void setLista(List<EditalDisciplina> lista) {
this.lista = lista;
}
public List<EditalDisciplina> getListaFiltro() {
return listaFiltro;
}
public void setListaFiltro(List<EditalDisciplina> listaFiltro) {
this.listaFiltro = listaFiltro;
}
public Edital getEdital() {
return edital;
}
public void setEdital(Edital edital) {
this.edital = edital;
}
public EditalDisciplinaDAO getEditalDisciplinaDAO() {
return editalDisciplinaDAO;
}
public void setEditalDisciplinaDAO(EditalDisciplinaDAO editalDisciplinaDAO) {
this.editalDisciplinaDAO = editalDisciplinaDAO;
}
public Disciplina getDisciplina() {
return disciplina;
}
public void setDisciplina(Disciplina disciplina) {
this.disciplina = disciplina;
}
}
Jobs is an attribute of my Entity EditalDiscipline (which is a many relationship table for many Edict and Discipline). So for each row of the table there appears a Spinner for me to insert as many vacancies for that discipline, but it happens that the vacancies do not stay in the discipline, so I can not use the variable of dataTable, so when I give Submit all the EditalDisciplina objects are with the same number of vacancies. How do I make each EditalDiscipline have its number of vacancies?