https://github.com/wildfly/wildfly/pull/7909 uses the Narayana
org.jboss.tm.listener.TransactionListenerRegistry to be notified when
the transaction is associated/deassociated with the JTA transaction.
I think that Hibernate ORM could do something similar with the
org.jboss.tm.listener.TransactionListenerRegistry to protect against
clearing the persistence context from a non-application thread, while
the application thread may be actively using the persistence context.
I think this approach is simpler than the thread id tracking.
On 03/10/2015 01:51 PM, Scott Marlow wrote:
>
> So what is this buying us?
>
The current Hibernate ORM thread id checking, does not properly handle
the case when the application thread changes between calls to the
Hibernate session. The new approach does handle the application thread
changing between session invocations and also covers a few other cases
as well (like clearing the persistence context after the application may
of added another entity after the background thread rolled back the
transaction).
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev