There is a DatasourceconnectionProviderImpl class which is the one hibernate uses when we declare the datasource as JNDI. However, we might need to do something more elaborate as we use JNDI when running in a container, but we use the internal driver manager one when running unit tests.