【发布时间】:2020-06-03 15:36:09
【问题描述】:
我现在每次执行更新或删除 Spring 数据 JPA 在运行实际查询之前选择时都使用 Spring 数据 JPA。
@Modifying
@Query("update Device d set d.latestDevice = ?1 where d.senderId = ?2")
@Transactional(readOnly = false)
int updateLatestDevice(Device newDevice, Integer senderId);
@Modifying
@Transactional(readOnly = false)
int deleteById(Integer deviceId);
我找不到这种情况的确切答案。
【问题讨论】:
-
这能回答你的问题吗? Hibernate select before update
-
上一个问题只讨论了如何禁用选择。我正在寻找在更新和删除之前触发选择的原因?
标签: spring-boot hibernate spring-data-jpa