KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm getting Unknown name value for enum class when trying to retrieve records from DB. Using JSF 2.0, JPA. The possible values in my DB are 'F' or 'J' Enum: public enum TipoPessoa { FISICA ("F", "Física"), JURIDICA ("J", "Jurídica"); private final String id; private final String descricao; private TipoPessoa(String id, String descricao){ this.id = id; this.descricao = descricao; } public String getId() { return id; } public String getDescricao(){ return descricao; } } Entity: @Column(nullable=false, length=1) private TipoPessoa tipoPessoa; public TipoPessoa getTipoPessoa() { return tipoPessoa; } public void setTipoPessoa(TipoPessoa tipoPessoa) { this.tipoPessoa = tipoPessoa; } When I try to read the records from DB I got the error Would you please help me on this issue? thanks Stack trace: javax.servlet.ServletException: Unknown name value for enum class br.com.aaa.xxx.entidade.TipoPessoa: F javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) br.com.aaa.filtro.FiltroEncode.doFilter(FiltroEncode.java:26) root cause javax.ejb.EJBTransactionRolledbackException: Unknown name value for enum class br.com.aaa.xxx.entidade.TipoPessoa: F .... ......
Tags (comma-separated)
Save Edits
Cancel