我尝试将以下代码添加到spring数据jpa存储库中:
@Query("insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)") void insertLinkToActivity(long commitId, long activityId);
但是应用程序不能以以下例外开头:
由以下原因引起:org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌:第1行第59列附近的值[插入commit_activity_link(commit_id,activity_id)VALUES(?1,?2)]
我哪里错了?
我必须添加nativeQuery = true到@Query
nativeQuery = true
@Query
@Query(value = "insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)", nativeQuery = true)