Interface ConnectionFactory


  • public interface ConnectionFactory
    Responsible to open connections with a specific database, could be a DataSource, DriverManager, SpringDataSource manager...
    Author:
    Alisson Gomes
    • Method Detail

      • open

        ConnectionAdapter open()
        Attempts to establish a connection to the database
        Returns:
        a Connection from the URL or DataSource
        Throws:
        net.sf.jkniv.sqlegance.RepositoryException - if cannot establish a connection
      • with

        ConnectionFactory with​(net.sf.jkniv.exception.HandleableException handlerException)
      • open

        ConnectionAdapter open​(net.sf.jkniv.sqlegance.transaction.Isolation isolation)
        Attempts to establish a connection to the database with specific isolation
        Parameters:
        isolation - isolation level from transaction
        Returns:
        a Connection from the URL or DataSource
        Throws:
        net.sf.jkniv.sqlegance.RepositoryException - if cannot establish a connection
      • getTransactionManager

        Transactional getTransactionManager()
        Create new Transaction Manager for JDBC transactions
        Returns:
        a LOCAL, GLOBAL or EJB transaction manager.
      • getContextName

        String getContextName()
        Name from repository context
        Returns:
        name of context
      • close

        void close​(ConnectionAdapter conn)
        null-safe close connection. Throws SQLException is logged as warning.
        Parameters:
        conn - connection to close
      • close

        void close​(PreparedStatement stmt)
        null-safe close PreparedStatement. Throws SQLException is logged as warning.
        Parameters:
        stmt - statement to close
      • close

        void close​(Statement stmt)
        null-safe close Statement. Throws SQLException is logged as warning.
        Parameters:
        stmt - statement to close
      • close

        void close​(ResultSet rs)
        null-safe close ResultSet. Throws SQLException is logged as warning.
        Parameters:
        rs - ResultSet to close
      • close

        void close​(CallableStatement call)
        null-safe close CallableStatement. Throws SQLException is logged as warning.
        Parameters:
        call - CallableStatement to close