Reputation:
I am using Spring data rest and I want to add some additional functionality to my repository.
@RestResource(exported = true)
public class ItemRepository extends JpaRepository<Item, Long> {
@Query("update ...")
void modifyItem();
}
The modifyItem()
method can only be accessed through a GET request at /items/find/modifyItem
How can I change the requestmethod to UPDATE?
How can I remove the "find" from the URI?
Upvotes: 1
Views: 1552
Reputation: 771
@Query(Update (Table name) SET (schema you want to update) = :variable WHERE ID=1)
public void update(@Param("variable") String variable);
I think that should work
Upvotes: 0
Reputation: 83081
Two issues here:
@Modifying
annotation to correctly execute the query.Upvotes: 3