Interface DataAcc

All Known Implementing Classes:
DataHub

public interface DataAcc
Provides access to named DataConn data connection instances.

This interface defines the contract for retrieving managed data connections registered under specific names within a data access scope (such as a DataHub). Application business logic uses this interface to obtain connection objects required to perform database or external service operations.

  • Method Summary

    Modifier and Type
    Method
    Description
    <C extends DataConn>
    C
    getDataConn(String name, Class<C> cls)
    Retrieves a data connection associated with the specified data source name and casts it to the requested connection class type.
  • Method Details

    • getDataConn

      <C extends DataConn> C getDataConn(String name, Class<C> cls) throws com.github.sttk.errs.Err
      Retrieves a data connection associated with the specified data source name and casts it to the requested connection class type.

      If a connection for the given name has already been created within the current transaction or execution scope, that connection instance is returned. Otherwise, a new connection is created via the corresponding registered data source.

      Type Parameters:
      C - the expected type of DataConn
      Parameters:
      name - the registered logical name of the data source
      cls - the Class representing the target connection type C
      Returns:
      the data connection instance associated with the specified name
      Throws:
      com.github.sttk.errs.Err - if no data source with the specified name is found, if creating the connection fails or yields null, or if the connection cannot be cast to the target type