I have an entity
public class Arena {
@Id
private final Long id;
@Embedded(onEmpty = Embedded.OnEmpty.USE_NULL)
final Point location;
}
Point comes from org.springframework.data.geo package
and Postgres schema to it
CREATE TABLE arena
(
id SERIAL NOT NULL
CONSTRAINT arena_pk
PRIMARY KEY,
location POINT
);
when I'm trying to use the entity via spring data jdbc repository (arenaRepository.findAll())
public interface ArenaRepository extends CrudRepository<Arena, Long> {
}
I get an error
Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT arena.id AS id, arena.y AS y, arena.x AS x FROM arena]; nested exception is org.postgresql.util.PSQLException: ERROR: column arena.y does not exist
I see that SQL does not match schema. But is it possible to work with 'geo' classes via Spring Data Jdbc?
I tried introduce location as List and it works. Is it the right way?