[英]Spring JPA/Hibernate: use multiple projections on same query interface
[英]JPA Hibernate Update query in interface
目標是更新表中的條目。 從概念上講,我需要...
public interface MessageRepository extends JpaRepository<Message, Long> {
@Modifying
@Transactional
@Query("update Message set isRead = true where receiver = id and isRead = false")
void markAllAsRead(Long id);
然而,當我運行它時,它會編譯它似乎事務從未提交過。 根據我需要刷新緩存的文檔。 我目前的設置和我在這里看到的一樣,這似乎不可能,因為我沒有函數體。 我正在嘗試修復其他人的代碼,所以我真的不想重構整個事情。
您是否嘗試過使用以下參數?
@Modifying(flushAutomatically = true)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.