I have a Java project that uses MyBatis to access a PostgreSQL database. PostgreSQL allows to return fields of a newly created row after an INSERT
statement, an
In this example using options
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface POJOCustomMapper {
@Options(useGeneratedKeys = true, keyProperty = "ID", keyColumn = "ID")
@Insert({
"insert into TABLE_A ( NAME "
"values (#{NAME,jdbcType=VARCHAR})"
})
long insert(POJO record);