Read-only access to the database is the easiest use case I can think of. Another option would be an application that controls the state of a transaction. And one more thing if you want to use a connection that will not participate in the global JTA transaction. The latter occurs in Quartz (see JobStoreCMT ).
But, while googling (this is a good question!), I found more inspiration in the section Using Non-Transactional Connections Sun Server Documentation:
The main advantage of using non-transactional connections is that the costs associated with attracting and disconnecting connections in transactional contexts are eliminated. However, use these connections carefully. For example, if a non-transactional connection is used to query the database during a transaction that modifies the database, the query retrieves the unchanged data in the database. This is because the transaction is not executing. In another example, if it is not a transactional connection that modifies the database, but a transaction that is running at the same time is rolled back, changes made by a non-transactional connection are not rolled back.
Here is a typical use case for a non-transactional connection: a component that updates the database in the context of a transaction that spans several iterations of a loop can update cached data using a non-transactional connection to read data before the transaction commits.
Interesting...
source share