I can not change my object coming from a dataTable - JSF with Primefaces

1

I am retrieving my object from the dataTable plus the time I redirect the dataTable to another page to make change, it presents an error. Plus it takes the ID of the object, I did a convert more without success.

MyConverter

packageconverter;importjavax.faces.component.UIComponent;importjavax.faces.context.FacesContext;importjavax.faces.convert.Converter;importjavax.faces.convert.FacesConverter;importjavax.inject.Inject;importdao.FabricanteDAO;importmodelo.Fabricante;@FacesConverter(forClass=Fabricante.class)publicclassFabricanteConverterimplementsConverter{@InjectprivateFabricanteDAOdao;publicObjectgetAsObject(FacesContextarg0,UIComponentarg1,Stringvalue){Fabricantefabricante=null;if(value!=null){fabricante=this.dao.buscarPeloCodigo(newLong(value));}returnfabricante;}publicStringgetAsString(FacesContextarg0,UIComponentarg1,Objectvalor){if(valor!=null){Fabricantefabricante=(Fabricante)valor;returnfabricante.getCodigo()==null?null:fabricante.getCodigo().toString();}return"";
    }

}
    
asked by anonymous 02.03.2017 / 02:33

1 answer

0

Change the @FacesConverter(forClass = Fabricante.class) annotation to only:

@Named
public class FabricanteConverter implements Converter {

Package: javax.inject.Named;

    
02.03.2017 / 11:52