-
1. Re: Versions created only on transaction commit ?
adamw Jan 27, 2009 2:38 AM (in response to amarsingh)Hello,
revisions are created only when a transaction is commited. That's beacuse flushing may occur at unpredicatble times, depending on your configuration, so when you execute update(), or a query. I think creating revisions on transaction commits is what you really want :)
--
Adam -
2. Re: Versions created only on transaction commit ?
amarsingh Jan 29, 2009 3:24 PM (in response to amarsingh)I was looking at the implementation and I believe the WorkUnits only get executed in case of Transaction commit, which means flushing will be ensured even if we allow versions creation at each saveandUpdate but final creation of version is only on transaction commit ?
My use case is to create 7 versions of an Object and if any intermediate version creation fails then don't create any version. This could have been easy if I follow the following algo:transaction.start(); object obj.... .. .. sessions.saveandUpdate(obj)... ... ... do this seven times and see if anything fails ....if no failure then commit the transaction ... ... transaction.commit();
Any ideas ? -
3. Re: Versions created only on transaction commit ?
adamw Jan 30, 2009 9:56 AM (in response to amarsingh)Hello,
you're right, the work units get executed only when the transaction as commited. Only then I can be sure what is the data content of the revision.
Why would anything fail when creating versions?
If anything does, then the whole transaciton will be rolled back, and no changes will be made.
--
Adam