亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 JPA 中使用 nativeQuery 時出現“無法提取 ResultSet”錯誤

在 JPA 中使用 nativeQuery 時出現“無法提取 ResultSet”錯誤

蕪湖不蕪 2023-07-28 16:58:02
我在 SpringBoot 中使用 JPARepository 并使用@Query注釋,但出現錯誤org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet當使用nativeQuery=true這是我的功能:@Query(value = "select * from table1 where status = ?1 and time <= ?2 LIMIT 2", nativeQuery = true)     List<MyModel> findScheduledSmsMessages(Status status, LocalDateTime time);
查看完整描述

1 回答

?
瀟湘沐

TA貢獻1816條經驗 獲得超6個贊

我在查詢上方添加了以下代碼并且


@Modifying

  @Transactional


像這樣 :


@Modifying

@Transactional

@Query(value = "DELETE FROM played_sheet WHERE user_id =  ?1 AND sheet_music_id = ?2", nativeQuery = true)

void deleteByUserIdAndSheetMusicId(Integer userId,Integer sheetMusicId);



查看完整回答
反對 回復 2023-07-28
  • 1 回答
  • 0 關注
  • 343 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號