geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@iq80.com>
Subject Re: [jira] Created: (GERONIMO-2809) TransactionManagerImpl.getTransactionStatus() shouldn't throw on no tx (with patch)
Date Sun, 11 Feb 2007 21:12:47 GMT
IIRC it should return STATUS_NO_TRANSACTION.

-dain

On Feb 11, 2007, at 1:06 PM, Andrus Adamchik wrote:

> Hi there,
>
> Wanted to call attention to this issue. Can somebody please apply  
> the patch attached to it?  (unless there are differing opinions  
> regarding the interpretation of the part of the JTA spec in question?)
>
> Thanks
> Andrus
>
>
> On Feb 7, 2007, at 9:09 AM, Andrus Adamchik (JIRA) wrote:
>
>> TransactionManagerImpl.getTransactionStatus() shouldn't throw on  
>> no tx (with patch)
>> --------------------------------------------------------------------- 
>> --------------
>>
>>                  Key: GERONIMO-2809
>>                  URL: https://issues.apache.org/jira/browse/ 
>> GERONIMO-2809
>>              Project: Geronimo
>>           Issue Type: Bug
>>       Security Level: public (Regular issues)
>>           Components: transaction manager
>>     Affects Versions: 2.0
>>             Reporter: Andrus Adamchik
>>              Fix For: 2.0
>>          Attachments: patch.txt
>>
>> org.apache.geronimo.transaction.manager.TransactionManagerImpl,  
>> implementation of  
>> "TransactionSynchronizationRegistry.getTransactionStatus()" method  
>> throws an IllegalStateException when called outside of active  
>> transaction. I believe this behavior is wrong. According to JTA  
>> javadocs:
>>
>> "int getTransactionStatus()
>> Return the status of the transaction bound to the current thread  
>> at the time this method is called. This is the result of executing  
>> TransactionManager.getStatus() in the context of the transaction  
>> bound to the current thread at the time this method is called.
>> Returns: the status of the transaction bound to the current thread  
>> at the time this method is called."
>>
>> So no exception is specified in the spec. Also current behavior  
>> caused grief when implementing a JPA provider. Most methods on the  
>> EntityManager have this note: "throws TransactionRequiredException  
>> if invoked on a container-managed entity manager of type  
>> PersistenceContextType.TRANSACTION and there is no transaction.",  
>> but currently the provider can't even check the tx status  
>> consistently, since this unexpected exception is thrown.
>>
>> See attached patch for the trivial fix.
>


Mime
View raw message