You can allow non-Java-EE components, such as servlet filters, lifecycle modules, and third party persistence managers, to use this JDBC connection pool. The returned connection is automatically enlisted with the transaction context obtained from the transaction manager. Standard Java EE components can also use such pools. Connections obtained by non-component callers are not automatically closed at the end of a transaction by the container. They must be explicitly closed by the caller.
You can enable non-component callers in the following ways:
Check the Allow Non Component Callers box on the Edit Connection Pool Advanced Attributes page in the Administration Console. The default is false. For more information, click the Help button in the Administration Console.
Specify the --allownoncomponentcallers option in the asadmin create-jdbc-connection-pool command. For more information, see the Oracle GlassFish Server 3.1-3.1.1 Reference Manual.
asadmin set domain1.resources.jdbc-connection-pool.DerbyPool.allow-non-component-callers=true
For more information, see the Oracle GlassFish Server 3.1-3.1.1 Reference Manual.
Create a JDBC resource with a __pm suffix.
Accessing a DataSource using the Synchronization.beforeCompletion() method requires setting Allow Non Component Callers to true. For more information about the Transaction Synchronization Registry, see The Transaction Manager, the Transaction Synchronization Registry, and UserTransaction.