Frage

I'm using mybatis in my project and I need to insert data on a column of type "point" (mysql).

How can I do it?

I've managed to create a mapper for my table but how can I specify the geometry data type for the query?

Thanks

War es hilfreich?

Lösung

The mysql statement for Point column is

INSERT INTO t1 (pt_col) VALUES(Point(1,2))

Thus you can just pass in the values accordingly in Mybatis?

A basic example will be like

@Insert( "INSERT INTO t1( pt_col ) values( Point( #{x}, #{y} )" )
public int insert( @Param("x") int x, @Param("y") int y );
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top