Boa noite, estou fazendo uma pagina de cadastro mas deparei com um problema no p:selectManyCheckbox
<p:outputLabel value="Nome" for="nomepa" />
<p:autoComplete id="nomepa" size="40" dropdown="true"
value="#{cadastroListaBean.espera.paciente}"
completeMethod="#{cadastroListaBean.completarPaciente}"
var="paciente" itemLabel="#{paciente.nome}" itemValue="#{paciente}"
forceSelection="true">
<p:ajax event="itemSelect" process="@this"
update="frmCadastroLista"
listener="#{cadastroListaBean.completarCampo}" />
</p:autoComplete>
<p:outputLabel value="Identificação" for="din" />
<h:outputText id="din" size="20" maxlength="30"
value="#{cadastroListaBean.espera.paciente.identificacao}" />
<p:outputLabel value="Sexo" for="sex" styleClass="sexo" />
<h:outputText id="sex" size="20" maxlength="30"
value="#{cadastroListaBean.espera.paciente.sexo.descricao}" />
<p:outputLabel value="Celular" for="cel" />
<h:outputText id="cel" maxlength="20"
value="#{cadastroListaBean.espera.paciente.telefone}" />
<p:outputLabel value="Idade" for="idad" />
<h:outputText id="idad" size="10" maxlength="10"
value="#{cadastroListaBean.espera.paciente.idade}" />
<p:outputLabel value="Urgência" for="urgencia" />
<p:selectManyCheckbox id="urgencia"
value="#{cadastroListaBean.espera.urgencia}">
<f:selectItems value="#{cadastroListaBean.urgencias}"
var="urgencia" itemValue="#{urgencia}"
itemLabel="#{urgencia.descricao}" />
</p:selectManyCheckbox>
Meu Bean
@Named
@ViewScoped
public class CadastroListaBean implements Serializable {
private static final long serialVersionUID = 1L;
private ListaEspera espera;
public void salvar() {
this.espera = cadastroListaService.salvar(this.espera);
}
public Urgencia[] getUrgencias(){
return Urgencia.values();
}
public ListaEspera getEspera() {
return espera;
}
public void setEspera(ListaEspera espera) {
this.espera = espera;
}
}
O erro que aparece é:
Caused by: javax.faces.FacesException: Target model Type is no a Collection or Array
at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValuesForModel(MenuRenderer.java:391)
at com.sun.faces.renderkit.html_basic.MenuRenderer.convertSelectManyValue(MenuRenderer.java:128)
at com.sun.faces.renderkit.html_basic.MenuRenderer.getConvertedValue(MenuRenderer.java:314)
at org.primefaces.component.selectmanycheckbox.SelectManyCheckboxRenderer.getConvertedValue(SelectManyCheckboxRenderer.java:39)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1034)
at javax.faces.component.UIInput.validate(UIInput.java:964)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1237)
at javax.faces.component.UIInput.processValidators(UIInput.java:702)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1220)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1220)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1220)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1164)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
… 53 more