Boa noite, estou com problema quando eu selecionando uma profissão no meu h:selectOneMenu do JSF.
out 06, 2015 3:00:35 AM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/cortexWeb] threw exception [javax.el.PropertyNotFoundException: /paciente/pacienteCadastrar.xhtml @45,122 value="#{profissaoBean.profissao.id_profissao}": Property 'id_profissao' not writable on type model.Profissao] with root cause
javax.el.PropertyNotFoundException: /paciente/pacienteCadastrar.xhtml @45,122 value="#{profissaoBean.profissao.id_profissao}": Property 'id_profissao' not writable on type model.Profissao
at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:133)
at javax.faces.component.UIInput.updateModel(UIInput.java:818)
at javax.faces.component.UIInput.processUpdates(UIInput.java:735)
at javax.faces.component.UIForm.processUpdates(UIForm.java:281)
at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1242)
at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1228)
at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Minha classe profissaoBean
@ManagedBean(value="profissaoBean")
@ViewScoped
public class ProfissaoBean {
private Locale currentLocale = new Locale("pt", "BR");
private Profissao profissao = new Profissao();
public void portugueseLocale() {
UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
currentLocale = new Locale("pt", "BR");
viewRoot.setLocale(currentLocale);
}
public Profissao getProfissao() {
return profissao;
}
public void setProfissao(Profissao profissao) {
this.profissao = profissao;
}
public List<SelectItem> getListaProfissao(){
ProfissaoDao dao = new ProfissaoDao();
List<Profissao> profissoes = dao.listarProfissao();
List<SelectItem> itens = new ArrayList<SelectItem>(profissoes.size());
for(Profissao prof : profissoes){
itens.add(new SelectItem(prof.getId_profissao(),prof.getProfissao_nome()));
}
return itens;
}
}
<h:selectOneMenu id="seletc_uf_nasc" value="#{ufEstadoBean.uf.id_uf}">
<f:selectItem itemValue="" itemLabel="Selecione..." />
<f:selectItems var="ufs" value="#{ufEstadoBean.listaUfEstado}" />
</h:selectOneMenu>
Meu classe Profissão
@Entity(name = "profissao")
public class Profissao {
@Id
@GeneratedValue
private int id_profissao;
@Column(length = 60)
private String profissao_nome;
public int getId_profissao() {
return id_profissao;
}
public void setId_profissoes(int id_profissao) {
this.id_profissao = id_profissao;
}
public String getProfissao_nome() {
return profissao_nome;
}
public void setProfissao_nome(String profissao_nome) {
this.profissao_nome = profissao_nome;
}
}
Alguém pode me ajuda
Obrigado