On Feb 26, 2005, at 8:18 AM, Jeremy Boynes wrote:
From IRC last night
<dain> djencks: can a Transaction object return status NO_TRANSACTION?
<djencks> right now, ours do but I believe that is an error
<djencks> I think after they are complete they should be STATUS_COMMITTED or STATUS_ROLLED_BACK
From the JavaDoc for Transaction.getStatus():
Returns:
The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value.
So yes, it definitely can, and code that is using Transaction needs to be able to handle that even if our particular implementation does not allow it.
I guess it depends on how you read that sentence. I could just as easily say, I have a transaction associated with the Transaction object and it is committed. If you were to interpret it that ways, then the the only time you would see NO_TRANSACTION would be during object construction before the actual physical transaction is created. Anyway, maybe we should ask for clarification.
Anyway, it is no skin off my back to add a check for this state, it just seems illogical to me.
-dain
