Interface SqlSession

  • All Known Implementing Classes:
    JdbcSimpleSession

    public interface SqlSession
    The SQL Engine session contract definition. In fact it's an adapter or a proxy to an internal stuff in one of the stacks on top of which the SQL Processor works. It's the first parameter to all primary methods in the SqlQueryEngine and SqlCrudEngine. The implementation depends on the stack, on top of which the SQL Processor works. In this SQL Processor version the next stacks can be used:
    • raw JDBC (default option)
    • Hibernate ORM
    • Spring DAO
    For these stacks the next session objects can be utilized:
    • For the raw JDBC stack the session is a wrapper around a Connection instance.
    • For the Hibernate ORM the session is a wrapper around a Hibernate Session instance.
    • For the Spring DAO the session is a wrapper around a Spring JdbcTemplate instance.

    The primary contract is the method for the SqlQuery instance creation.

    For the concrete implementation please see for example JdbcSession or JdbcSimpleSession.

    For more info please see the Tutorials.

    Author:
    Vladimir Hudec
    • Method Detail

      • createSqlQuery

        SqlQuery createSqlQuery​(String queryString)
                         throws SqlProcessorException
        Creates a new instance of SqlQuery, which is a wrapper around the SQL query command.
        Parameters:
        queryString - the SQL query command
        Returns:
        a new instance of a wrapper around the SQL query command
        Throws:
        SqlProcessorException - in the case of any problem in ORM or JDBC stack
      • executeBatch

        int[] executeBatch​(String... statements)
                    throws SqlProcessorException
        Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.
        Parameters:
        statements - SQL statements to be executed in batch
        Returns:
        an array of update counts containing one element for each command in the batch
        Throws:
        SqlProcessorException - in the case of any problem in ORM or JDBC stack
      • getName

        String getName()
        The name of the database related to this session. It's usage is implementation specific.
        Returns:
        the name of the database related to this session