Package org.sqlproc.engine
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 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 Summary
Modifier and TypeMethodDescriptioncreateSqlQuery
(String queryString) Creates a new instance ofSqlQuery
, which is a wrapper around the SQL query command.int[]
executeBatch
(String... statements) Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts.getName()
The name of the database related to this session.
-
Method Details
-
createSqlQuery
Creates a new instance ofSqlQuery
, 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
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
-