2 Replies Latest reply on Nov 9, 2009 9:17 AM by kevinrs5855

    Using Envers within Hibernate 3.5 BETA-2 without explicit Tr

    kevinrs5855

      Adam,

      I have been a big fan of your work with the Envers project. The project I am currently working on uses Hibernate but with no transactions. We simply use Auto Commit and Manual Flush mode with none of our database access being wrapped in transactions for reads or writes. While attempting to use the Hibernate 3.5 Beta 2 in order to try to use envers for my project I ran into a small problem. It appears that Envers needs a transaction to be in progress in order for it to run properly since it uses the transaction synchronization in order to actually attempt to commit the AuditSynch Units of Work.

      See line 56 of AuditSynchManager which has the following code,
      transaction.registerSynchronization(verSync);

      I wanted to ask if what I am saying makes sense and is in fact correct. Can you only use the Envers project if you use Transactions for your Unit of Work. We use a strategy of eventual consistency for our database tables and hence don't have any active transactions when using the Hibernate Sessions. Is there any other way to integrate with your work to allow the envers framework to be triggered? Lastly, I would recommend documenting this somewhere in the site or as part of the FAQ so that others don't have to spend time trying to get things working wondering what went wrong.

      Thanks for your help and time.