I have a JPA repository interface with the following method:
@Modifying
@Query(value = "DELETE FROM bivrip.bloop_options o WHERE o.bloop_id = ?1 AND o.id not in ?2", nativeQuery = true)
public void removeOtherOptions(int bloopID, List<Integer> validOptionIDs);
When validOptionIDs contains at least one element, the method behaves as expected and removes all ids not in the list associated with the given bloop. However, if the list is empty, it doesn’t delete anything – when I would assume it would delete all options for the provided bloop.
Do I need to do anything extra configuration-wise in order to make this work? Or am I condemned to writing another method along the lines of “removeAllOptionsForBloop”?
Note: If this should generally work and is a result of particular database implementation, I’m using postgres.