Skip to content

AttributeConverter is not applying while reading data #223

@sahashmi

Description

@sahashmi

I have Odata4 service based on this tech stack:

Spring Boot 2.7.14
Java 8
Apache Olingo 4.9.0
SAP JPA Processor 1.0.9
Eclipselink 2.7.13
PostgreSQL

In my Entity class I have GeospatialCollection mapped to geometry Postgresql column like,

@Column(name = "geography")
@EdmGeospatial(dimension = Geospatial.Dimension.GEOMETRY, srid = "27700")
private GeospatialCollection geography;

I also have AttributeConverter that converts Geospatial type to PGobject and vice versa, converter definition is.

@converter(autoApply = true)
public class GeospatialConverterToRead implements AttributeConverter<GeospatialCollection, PGobject> {

@Override
public PGobject convertToDatabaseColumn(GeospatialCollection geospatials) {
    //PGobject pGobject = new PGobject();
    //return pGobject;
}

@Override
public GeospatialCollection convertToEntityAttribute(PGobject pGobject) {
    //List<Geospatial> geospatialList = new ArrayList<>();
    //GeospatialCollection  geospatialCollection = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, geospatialList);
    //return geospatialCollection;
}

}

This converter is working for POST/write request, when reading data converter is not picking up and this debug message is printed:

2023-08-31 15:01:31.536 DEBUG 15628 --- [nio-8080-exec-1] c.s.o.j.processor.cb.impl.TypeConverter : No converter found to convert PGobject to GeospatialCollection

Could you elaborate what is happening here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions