I store file’s attributes (size, update time…) in database. So the problem is how to manage transaction for database and file.
In a Java EE environment, JTA is just
manually. You'll probably need to write compensatory transactions for this.