public class JdbcSession extends Object implements InvocationHandler
Connection.
It's the first parameter to all primary methods in the SqlQueryEngine and SqlCrudEngine.
The implementation is based on the dynamic proxy design pattern provided by the Java API.
The primary contract is the method for the SqlQuery instance creation.
For more info please see the Tutorials.
| Modifier and Type | Field and Description |
|---|---|
private Connection |
connection
The connection to the database.
|
private String |
name
The name of the database related to this session.
|
private static Class[] |
PROXY_INTERFACES
The contracts implemented by this dynamic proxy.
|
| Modifier | Constructor and Description |
|---|---|
private |
JdbcSession(Connection connection)
Creates a new instance of this dynamic proxy.
|
|
JdbcSession(Connection connection,
String name)
Creates a new instance of this dynamic proxy.
|
| Modifier and Type | Method and Description |
|---|---|
static SqlSession |
generateProxy(Connection connection)
The factory method to obtain this dynamic proxy.
|
static SqlSession |
generateProxy(Connection connection,
String name)
The factory method to obtain this dynamic proxy.
|
static ClassLoader |
getProxyClassLoader()
Returns the class loader instance.
|
Object |
invoke(Object proxy,
Method method,
Object[] args) |
private static final Class[] PROXY_INTERFACES
private Connection connection
private String name
private JdbcSession(Connection connection)
connection - the connection to the databasepublic JdbcSession(Connection connection, String name)
connection - the connection to the databasename - the name of the databasepublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke in interface InvocationHandlerThrowablepublic static SqlSession generateProxy(Connection connection)
connection - the connection to the databasepublic static SqlSession generateProxy(Connection connection, String name)
connection - the connection to the databasename - the name of the databasepublic static ClassLoader getProxyClassLoader()
Copyright © 2017. All rights reserved.