Returning values from MyBatis mapped methods

前端 未结 5 813
无人及你
无人及你 2020-12-28 08:33

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

5条回答
  •  甜味超标
    2020-12-28 09:11

    You can also use generated keys:

      
            INSERT INTO ODBOR 
                (NAZEV, POPIS, ZKRATKA, WEBROLE, JEODBOR, AKTIVNI)
            VALUES 
                (#{nazev}, #{popis}, #{webrole}, #{webrole}, false, #{aktivni})
      
    

    After insert, parameter has property id set to value from column id.

提交回复
热议问题