【发布时间】:2021-09-26 01:39:52
【问题描述】:
我有实体,它通过jdbcTemplate 更新和创建:
transactionTemplate.execute {
myRepository.save(MyEntity(...))
jdbcTemplate.update("UPDATE my_entity ...")
entityManager.flush()
}
myRepository.getById(...) // Old version of entity from hibernate cache
但是当我获取更新的实体时,我会从缓存中获取未刷新的版本。这里有什么问题?例如,当我使用 Modifying 调用本机查询时,一切正常。
【问题讨论】:
标签: spring-boot kotlin jpa spring-data-jpa