Skip to content

JDBC data types from org.postgresql.geometric are treated as referenced agreggates instead of jdbc data types #1065

Closed
@iarobles

Description

@iarobles

There seems to be a problem when save or findById methods of the CrudRepository are called on an entity that has a property of the type in org.postgresql.geometric (for example PGpoint). This types are used to map postgres geometric data types: https://www.postgresql.org/docs/9.4/datatype-geometric.html. A similar problem happens with any of the PostGIS JDBC types.

The error seems to be due to Spring Data JDBC treating the property as if it were a referenced aggregate instead of a data type describing a column data type. For example, for an entity with the following properties:

@Table("example")
public class Example {
    @Id
    private int id;
    private String info;
    private PGpoint singlePoint;

    public int getId() {return id;}
    public void setId(int id) {this.id = id;}
    public String getInfo() {return info;}
    public void setInfo(String info) {this.info = info;}
    public PGpoint getSinglePoint() { return singlePoint;}
    public void setSinglePoint(PGpoint singlePoint) {this.singlePoint = singlePoint;}
}

when save is called on an instance of this class, the following error happens (debug level):

INSERT INTO "p_gpoint" ("example", "is_null", "type", "value", "x", "y") VALUES (?, ?, ?, ?, ?, ?)] for task [PreparedStatementCallback

Note that "x", "y", "isNull", etc. are public properties of the PGPoint class: https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/geometric/PGpoint.java

Let me know if you need more information and thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions