![](/img/trans.png)
[英]Spring data JPA auditing does not work during update in spring boot project
[英]Spring Boot JPA @Query Update does not work
我正在使用 Springboot 并且我正在尝试创建一个使用本机查询更新属性的函数
这是我的界面的一部分:
@Modifying(clearAutomatically = true, flushAutomatically = true) // mandatory if native quaries are modying something in the dataBase
@Transactional
@Query("""
update pojazd
set czy_zarchiwizowany = true
where id =: selected_id""", nativeQuery = true)
fun archwizujPojazd(@Param("selected_id") selected_id:Long):Boolean
该功能有效。 它返回true,但它对数据库没有影响
有什么帮助吗?
我在这里浏览了一堆类似的主题,但没有解决方案。
我会很高兴得到你的帮助。
请添加“pojazd”的类详细信息。 可能会错过匹配名称“id”的机会。 如果您阅读此博客Spring Data JPA @Modifying Annotation ,这将很有帮助。
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Transactional
@Query(value = "update pojazd set czy_zarchiwizowany = true
where id = :selected_id", nativeQuery = true)
fun archwizujPojazd(@Param(value="selected_id") Long selected_id);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.