@Override public Connection getConnection() throws SQLException { if (getPool() == null) { throw new IllegalStateException("Pool has not been set"); } if (transactionRegistry == null) { throw new IllegalStateException("TransactionRegistry has not been set"); } return new ManagedConnection<>(getPool(), transactionRegistry, isAccessToUnderlyingConnectionAllowed()); } }