On JavaEE environment, I use JPA 2.1 implementation with EclipseLink,
I have some entities that contain enums. So I have created converters for these enume
Give this a try and ensure you have included the correct packages.
Stays the same
import javax.persistence.Convert;
@Entity
public class Car implements Serializable {
[...]
@Convert(converter = CarColorConverter.class)
private CarColor color;
[...]
}
You only need the empty Annotation
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter
public class CarColorConverter implements AttributeConverter {
[...]
}
You can either
or
As soon as you need to declare an entity manually (e.g. when it resists in a library) then you also need do declare all other entity/converter classes.
com.xyz.model.converters.CarColorConverter
com.xtz.model.Car
[...]