使用Spring Data JPA时,我有以下本机sql插入查询:
@Modifying
@Query(value = "insert into marker(name, event_id, position, tag_ids, gmt_create, gmt_modified)" +
" values(?#{#m.name}, ?#{#m.eventId}, ST_GeomFromText(?#{#m.position})" +
", ?#{#m.tagIds}, ?#{#m.gmtCreate}, ?#{#m.gmtModified})"
, nativeQuery = true)
Marker save(@Param(value = "m") Marker marker);
问题是如何获取自动生成的ID?非常感谢你!