如何使用CrudRepository或JpaRepository的@Query()执行许多本机查询: 例如:
@Transactional
@Modifying
@Query(value = "delete from A_B_LIST where B_LIST_ID = ?1; delete from B where ID = ?1;", nativeQuery=true)
deleteById(@Param("id") Long id);
here the schema of bd:
table A: |id| table B: |id| table A_B_LIST: |A_LIST_ID|B_LIST_ID| foreigns keys:
| 1| | 1| | 1 | 1 | A_B_LIST.A_LIST_ID -> A.ID
| 2| | 1 | 2 | A_B_LIST.B_LIST_ID -> B.ID