문제

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

도움이 되었습니까?

해결책

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 );
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top