Package org.sqlproc.engine.spring
Class SpringSimpleSession
java.lang.Object
org.sqlproc.engine.spring.SpringSimpleSession
- All Implemented Interfaces:
SqlSession
The Spring stack implementation of the SQL Engine session contract. In fact it's a simple wrapper for the
JdbcTemplate.
It's the first parameter to all primary methods in the SqlQueryEngine and SqlCrudEngine.
The primary contract is the method for the SqlQuery instance creation.
For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.springframework.jdbc.core.JdbcTemplateThe Spring JdbcTemplate, the central class for all Spring database operations.private StringThe name of the database related to this session. -
Constructor Summary
ConstructorsConstructorDescriptionSpringSimpleSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) Creates a new instance.SpringSimpleSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String name) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptioncreateSqlQuery(String queryString) int[]executeBatch(String... statements) org.springframework.jdbc.core.JdbcTemplateReturns the internal Spring JdbcTemplate instance.getName()voidsetJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) Sets the internal Spring JdbcTemplate instance.
-
Field Details
-
jdbcTemplate
org.springframework.jdbc.core.JdbcTemplate jdbcTemplateThe Spring JdbcTemplate, the central class for all Spring database operations. -
name
The name of the database related to this session. It's usage is implementation specific.
-
-
Constructor Details
-
SpringSimpleSession
public SpringSimpleSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) Creates a new instance.- Parameters:
jdbcTemplate- the Spring JdbcTemplate instance
-
SpringSimpleSession
Creates a new instance.- Parameters:
jdbcTemplate- the Spring JdbcTemplate instancename- the name of the database
-
-
Method Details
-
getJdbcTemplate
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()Returns the internal Spring JdbcTemplate instance.- Returns:
- the internal Spring JdbcTemplate instance
-
setJdbcTemplate
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) Sets the internal Spring JdbcTemplate instance.- Parameters:
jdbcTemplate- the internal Spring JdbcTemplate instance
-
createSqlQuery
- Specified by:
createSqlQueryin interfaceSqlSession- Throws:
SqlProcessorException
-
executeBatch
- Specified by:
executeBatchin interfaceSqlSession- Throws:
SqlProcessorException
-
getName
- Specified by:
getNamein interfaceSqlSession- Returns:
- the name of the database related to this session. It's usage is implementation specific.
-