Package org.sqlproc.engine.jdbc
Class JdbcSession
java.lang.Object
org.sqlproc.engine.jdbc.JdbcSession
- All Implemented Interfaces:
InvocationHandler
The JDBC stack implementation of the SQL Engine session contract. In fact it's a proxy to the
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.
- Author:
- Vladimir Hudec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConnectionThe connection to the database.private StringThe name of the database related to this session.private static final Class[]The contracts implemented by this dynamic proxy. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateJdbcSession(Connection connection) Creates a new instance of this dynamic proxy.JdbcSession(Connection connection, String name) Creates a new instance of this dynamic proxy. -
Method Summary
Modifier and TypeMethodDescriptionstatic SqlSessiongenerateProxy(Connection connection) The factory method to obtain this dynamic proxy.static SqlSessiongenerateProxy(Connection connection, String name) The factory method to obtain this dynamic proxy.static ClassLoaderReturns the class loader instance.
-
Field Details
-
PROXY_INTERFACES
The contracts implemented by this dynamic proxy. -
connection
The connection to the database. It should be opened. -
name
The name of the database related to this session. It's usage is implementation specific.
-
-
Constructor Details
-
JdbcSession
Creates a new instance of this dynamic proxy.- Parameters:
connection- the connection to the database
-
JdbcSession
Creates a new instance of this dynamic proxy.- Parameters:
connection- the connection to the databasename- the name of the database
-
-
Method Details
-
invoke
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
generateProxy
The factory method to obtain this dynamic proxy.- Parameters:
connection- the connection to the database- Returns:
- the JDBC stack implementation of the SQL Engine session contract
-
generateProxy
The factory method to obtain this dynamic proxy.- Parameters:
connection- the connection to the databasename- the name of the database- Returns:
- the JDBC stack implementation of the SQL Engine session contract
-
getProxyClassLoader
Returns the class loader instance.- Returns:
- the class loader instance
-