* @return The Connection
* @throws NucleusException Thrown if an error occurs getting the connection
*/
public ManagedConnection getConnection(ObjectManager om, Map options)
{
ConnectionFactoryRegistry registry = om.getOMFContext().getConnectionFactoryRegistry();
ConnectionFactory connFactory;
if (om.getTransaction().isActive())
{
connFactory = registry.lookupConnectionFactory(txConnectionFactoryName);
}
else
{
if (nontxConnectionFactoryName != null)
{
connFactory = registry.lookupConnectionFactory(nontxConnectionFactoryName);
}
else
{
// Some datastores don't define non-tx handling so just fallback to the primary factory
connFactory = registry.lookupConnectionFactory(txConnectionFactoryName);
}
}
return connFactory.getConnection(om, options);
}