Package org.sqlproc.engine.spring
Class SpringSimpleSession
- java.lang.Object
-
- org.sqlproc.engine.spring.SpringSimpleSession
-
- All Implemented Interfaces:
SqlSession
public class SpringSimpleSession extends Object implements SqlSession
The Spring stack implementation of the SQL Engine session contract. In fact it's a simple wrapper for theJdbcTemplate
. It's the first parameter to all primary methods in theSqlQueryEngine
andSqlCrudEngine
.The primary contract is the method for the
SqlQuery
instance creation.For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.springframework.jdbc.core.JdbcTemplate
jdbcTemplate
The Spring JdbcTemplate, the central class for all Spring database operations.private String
name
The name of the database related to this session.
-
Constructor Summary
Constructors Constructor Description SpringSimpleSession(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlQuery
createSqlQuery(String queryString)
int[]
executeBatch(String... statements)
org.springframework.jdbc.core.JdbcTemplate
getJdbcTemplate()
Returns the internal Spring JdbcTemplate instance.String
getName()
void
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Sets the internal Spring JdbcTemplate instance.
-
-
-
Field Detail
-
jdbcTemplate
org.springframework.jdbc.core.JdbcTemplate jdbcTemplate
The Spring JdbcTemplate, the central class for all Spring database operations.
-
name
private String name
The name of the database related to this session. It's usage is implementation specific.
-
-
Constructor Detail
-
SpringSimpleSession
public SpringSimpleSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Creates a new instance.- Parameters:
jdbcTemplate
- the Spring JdbcTemplate instance
-
SpringSimpleSession
public SpringSimpleSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String name)
Creates a new instance.- Parameters:
jdbcTemplate
- the Spring JdbcTemplate instancename
- the name of the database
-
-
Method Detail
-
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
public SqlQuery createSqlQuery(String queryString) throws SqlProcessorException
- Specified by:
createSqlQuery
in interfaceSqlSession
- Throws:
SqlProcessorException
-
executeBatch
public int[] executeBatch(String... statements) throws SqlProcessorException
- Specified by:
executeBatch
in interfaceSqlSession
- Throws:
SqlProcessorException
-
getName
public String getName()
- Specified by:
getName
in interfaceSqlSession
- Returns:
- the name of the database related to this session. It's usage is implementation specific.
-
-