Interface DataSourceSupplier

    • Method Detail

      • getDataSource

        DataSource getDataSource()
        Return the DataSource to use for the current request.

        This should take into account multi-tenancy and the current tenantId.

      • getReadOnlyDataSource

        DataSource getReadOnlyDataSource()
        Return the read only DataSource to use for the current request.

        This can return null meaning that no read only DataSource (with autoCommit) is available for use so normal transactions with explicit commit should be used.

      • getConnection

        Connection getConnection​(Object tenantId)
                          throws SQLException
        Return a connection from the DataSource taking into account a tenantId for multi-tenant lazy loading.
        Parameters:
        tenantId - Most often null but well supplied indicates a multi-tenant lazy loading query
        Returns:
        the connection to use
        Throws:
        SQLException
      • getReadOnlyConnection

        Connection getReadOnlyConnection​(Object tenantId)
                                  throws SQLException
        Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading.
        Parameters:
        tenantId - Most often null but well supplied indicates a multi-tenant lazy loading query
        Returns:
        the connection to use
        Throws:
        SQLException
      • shutdown

        void shutdown​(boolean deregisterDriver)
        Shutdown the datasource de-registering the JDBC driver if requested.