Added removeFileIfPossible(file)

Matija Obreza requested to merge remove-file-if-possible into main

Deleting entity with JPA/Hibernate causes Hibernate to flag the entire transaction as read-only because of a deep SQL exception. This is considered fatal in Hibernate.

This implementation uses JDBC to execute delete statements outside entity manager, catches DataViolationException and throws a new ReferencedRepositoryFileException that does not roll-back the transaction.

Merge request reports