Part I Development Tasks and Tools
1. Setting Up a Development Environment
Part II Developing Applications and Application Components
6. Using the Java Persistence API
7. Developing Web Applications
8. Using Enterprise JavaBeans Technology
9. Using Container-Managed Persistence
12. Developing Lifecycle Listeners
13. Developing OSGi-enabled Java EE Applications
Part III Using Services and APIs
14. Using the JDBC API for Database Access
15. Using the Transaction Service
Handling Transactions with Databases
Using JDBC Transaction Isolation Levels
Using Non-Transactional Connections
Handling Transactions with Enterprise Beans
Bean-Level Container-Managed Transaction Timeouts
Handling Transactions with the Java Message Service
Transactions and Non-Persistent Messages
Using the ConfigurableTransactionSupport Interface
16. Using the Java Naming and Directory Interface
To access a UserTransaction instance, you can either look it up using the java:comp/UserTransaction JNDI name or inject it using the @Resource annotation.
Accessing a DataSource using the Synchronization.beforeCompletion() method requires setting Allow Non Component Callers to true. The default is false. For more information about non-component callers, see Allowing Non-Component Callers.
If possible, you should use the javax.transaction.TransactionSynchronizationRegistry interface instead of javax.transaction.TransactionManager, for portability. You can look up the implementation of this interface by using the JNDI name java:comp/TransactionSynchronizationRegistry. For details, see the Javadoc page for Interface TransactionSynchronizationRegistry and Java Specification Request (JSR) 907.
If accessing the javax.transaction.TransactionManager implementation is absolutely necessary, you can look up the GlassFish Server implementation of this interface using the JNDI name java:appserver/TransactionManager. This lookup should not be used by the application code.