I'm using Spring Boot and I'm trying to make a function that updates an attribute using a native query.
This is a part of my interface:
@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
The function works. It returns true, but it has no effect on the database.
I have browsed through a bunch of similar topics on here with no solution.
@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);