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
JTA is not simply for Databases, it can be used long with any other resource if that resource supports XA transaction. For example, XADisk enables one such integration of file-systems with XA transactions. Hence, it can also solve the problem of file-system and database consistency which you have been trying to solve.
Hope that helps.
Nitin