There are no established tools in Hibernate for this. You should write a SQL query that will fetch from all referencing tables. The structure of the database is not presented in the question, so I will try to give an abstract example of such a query:
SELECT * FROM File WHERE id NOT IN ( SELECT file_id FROM table1 UNION SELECT file_id FROM table2 UNION ... )
You can execute a query using javax.persistence.EntityManager.createNativeQuery or org.hibernate.Session.createSQLQuery , depending on which API you use. Such a request can be very resource-intensive, so you should conduct performance tests, analysis of the request.
If you fail to achieve the desired performance / speed of execution, issue a new question about this with a description of the structure of the tables, registering it with tags related to SQL, and not to Hibernate, and be sure to specify which DBMS is used (in the tags too).