[hibernate-dev] JdbcSession proposal

Scott Marlow smarlow at redhat.com
Tue Aug 5 11:32:46 EDT 2014


More in-line below.

On 08/05/2014 10:52 AM, Scott Marlow wrote:
> Steve,
>
> This is the test case that I was talking about on IRC.  It simulates
> what happens when several remote EJB calls occur using the same JTA
> transaction.  This case is probably common enough that we should solve it.
>
> The workaround is to set hibernate.jta.track_by_thread=false.
>
>
>
> On 06/24/2014 10:23 PM, Scott Marlow wrote:
>> I pushed a test case that simulates what can happen with remote EJB
>> invocations that share the same JTA transaction & EntityManager.  The
>> "Transaction was rolled back in a different thread!" error [2] is thrown
>> but shouldn't be, since the active application thread has changed to a
>> different thread (which can happen).  The workaround is to set
>> "hibernate.jta.track_by_thread" to false.
>>
>> I think that we need to save the thread id at the start of every
>> application call into the EntityManager.

I'm wondering if a different approach than using the thread id, would 
cover more cases (specifically the distributed + remote cases).  For 
example, adding a configuration option for a session level lock that the 
SessionImpl implements, to protect against two threads calling into the 
same session concurrently.

>>
>> Scott
>>
>> [1] https://github.com/scottmarlow/hibernate-orm/tree/sametx_multithreads
>>
>> [2] https://gist.github.com/scottmarlow/63c4ab686368853d759b
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>



More information about the hibernate-dev mailing list