Method does not override or implement a method from a supertype

2

I'm creating a converter and it's giving me this error:

  

Method does not override or implement a method from a supertype

Converter code:

package com.mycompany.conversor;

import com.mycompany.entidades.agendaTipo;
import com.mycompany.repositorio.agendaTipoRepositorio;
import java.lang.annotation.Annotation;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.FacesConverter;
import javax.inject.Inject;
import javax.persistence.Converter;


@FacesConverter(forClass = agendaTipo.class)
public class agendaTipoConverter implements Converter{

    @Inject
    private agendaTipoRepositorio agendaTipoRepositorio;

    @Override
    public Object getAsObject(FacesContext context,
    UIComponent component, String value) {
        agendaTipo retorno = null;
        if (value != null && !"".equals(value)) {
            retorno = this.agendaTipoRepositorio.porId(new Long(value));
        }
        return retorno;
    }

    @Override
    public String getAsString(FacesContext context,
    UIComponent component, Object value) {
        if (value != null) {
            agendaTipo agendaTipo = ((agendaTipo) value);
            return agendaTipo.getId() == null ? null : agendaTipo.getId().toString();
        }
        return null;
    }
}
    
asked by anonymous 07.02.2017 / 14:42

1 answer

0

You are importing the wrong "Converter" class. The import you used was this:

javax.persistence.Converter

Change the import to this:

javax.faces.convert.Converter

The converter you used is part of the JPA implementation, which does not have to be with the JSF converters, and because they are different classes the methods to implement them obviously are also different.

    
08.02.2017 / 19:57