Hi,
I'm looking at the Ebean code, to see if there is a simple way of managing the transaction scope myself. My use case is in Play framework. Unlike other web frameworks, Play is from the ground up an asynchronous web framework, a single web request may bounce between many threads before the request is complete. It is therefore very important that anything that uses thread locals have its state transferred between threads. Play already uses a thread local, called the http context, and is very careful to pass this thread local between threads. The http context contains a map for storing arbitrary state related to that request, and this would be the perfect place to put the ebean transaction scope, because it would mean all thead local state is managed in one place, rather than having to, for every framework that we support that uses thread locals, transfer it manually.
Now, I don't really want to use JTA, or implement my own transaction manager, I don't care about how transactions are managed, I just want to tell ebean where to store its current transaction scope. So it seems that the right place for me to implement this is to provide my own TransactionScopeManager, and implement all the logic in there for commit/rollback/replace etc. Is there a simpler way where I could just implement the logic for setting/getting the scope from a thread local? And then the only way to configure this scope manager would be to provide my own InternalConfiguration that overrode the getTransactionManagerScope().
Is this the right approach for me to take?
Cheers,
James