let's assume we have a Spring Data repository interface with a custom method...

```
@Modifying
@Transactional
@Query("UPDATE MyEntity SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?1")
void markAsSoftDeleted(long id);

```

This method simply sets the deletedAt field of the entity, ok. Is there any way to allow this method to return an updated version of the `MyEntity`?

Obviously...

```
@Modifying
@Transactional
@Query("UPDATE MyEntity SET deletedAt = CURRENT_TIMESTAMP WHERE id = ?1")
MyEntity markAsSoftDeleted(long id);

```

...does not work, since...

> 
> java.lang.IllegalArgumentException: Modifying queries can only use void or int/Integer as return type! 
> 
> 
> 

Does anyon know another way to easily allow that, except of course the obvious "add a service layer between repository and caller for such things"...