Community
Participate
Working Groups
I have an entity with an @Convert annotation on a field and the conversion is getting run and it persists to the database properly. When retrieving that newly persisted value the Pojo coming back does not have the converted value. If I clear the cache before retrieving the value is correct. Is this some kind of caching configuration issue on my end or a bug with @Converter and caching ? Here is some pseudo code: @Converter public class EmptyStringToNull implements AttributeConverter <String, String> { @Override public String convertToDatabaseColumn(String v) { return Strings.emptyToNull(v); } @Override public String convertToEntityAttribute(String v) { return Strings.emptyToNull(v); } } @Entity public class Model { public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getValue() { return value; } public void setId(String value) { this.value = value; } @Id @Column(name="id") private Long id; @Convert(converter = EmptyStringToNull.class) @Column(name="value") private String value; } Model m = new Model(); m.setId(1); m.setValue(""); em.persist(m); em.find(Entity.class, 1).getValue() //returns "" ... em.persist(m); getEntityManagerFactory().getCache().evictAll(); em.find(Entity.class, 1).getValue() //returns null
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink