public class SqlSession extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
protected ClassCreator |
classCreator
Use to generate proxy on the dao
|
protected Connection |
connection
Current JDBC connection
|
protected DataSource |
dataSource
Current datasource
|
protected Map<String,PipeFunction> |
pipeFunctions
Current pipe functions available
|
| Constructor and Description |
|---|
SqlSession() |
SqlSession(DataSource dataSource)
Create session from a datasource
|
SqlSession(String url,
String username,
String password)
Create session from url, username and password
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFunction(Map<String,PipeFunction> functions) |
void |
addFunction(String name,
PipeFunction function) |
void |
close()
Close the current transaction.
|
void |
commit()
Commit the current transaction.
|
Connection |
getConnection()
Use to get the current transaction when the SQL statements is executed.
|
<E> E |
getDao(Class<E> klass,
Object... args)
Get a current dao plug on the session.
|
DataSource |
getDataSource() |
Map<String,PipeFunction> |
getPipeFunctions() |
void |
rollback()
Rollback the current transaction.
|
protected Map<String,PipeFunction> pipeFunctions
protected DataSource dataSource
protected Connection connection
protected ClassCreator classCreator
public SqlSession()
public SqlSession(String url, String username, String password)
public SqlSession(DataSource dataSource)
public DataSource getDataSource()
public void addFunction(String name, PipeFunction function)
public void addFunction(Map<String,PipeFunction> functions)
public Map<String,PipeFunction> getPipeFunctions()
public Connection getConnection() throws SQLException
SQLExceptionpublic void commit()
throws SQLException
SQLExceptionpublic void rollback()
throws SQLException
SQLExceptionpublic void close()
throws SQLException
close in interface AutoCloseableSQLExceptionCopyright © 2017–2019 CodeLutin. All rights reserved.