native insert query in hibernate + spring data

前端 未结 2 1957
北海茫月
北海茫月 2020-12-18 21:41

I try to add the following code to a spring data jpa repository:

  @Query(\"insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)\")
  vo         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-18 21:59

    I had to add nativeQuery = true to @Query

    @Query(value = "insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)", nativeQuery = true)
    

提交回复
热议问题