org.apache.ibatis.logging.jdbc.ConnectionLogger Java Examples
The following examples show how to use
org.apache.ibatis.logging.jdbc.ConnectionLogger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RWPlugin.java From spring-boot-mybatis-rw with Apache License 2.0 | 5 votes |
/** * MyBatis wraps the JDBC Connection with a logging proxy but Spring registers the original connection so it should * be unwrapped before calling {@code DataSourceUtils.isConnectionTransactional(Connection, DataSource)} * * @param connection May be a {@code ConnectionLogger} proxy * @return the original JDBC {@code Connection} */ private Connection unwrapConnection(Connection connection) { if (Proxy.isProxyClass(connection.getClass())) { InvocationHandler handler = Proxy.getInvocationHandler(connection); if (handler instanceof ConnectionLogger) { return ((ConnectionLogger) handler).getConnection(); } } return connection; }
Example #2
Source File: BaseExecutor.java From mybaties with Apache License 2.0 | 5 votes |
protected Connection getConnection(Log statementLog) throws SQLException { Connection connection = transaction.getConnection(); if (statementLog.isDebugEnabled()) { //如果需要打印Connection的日志,返回一个ConnectionLogger(代理模式, AOP思想) return ConnectionLogger.newInstance(connection, statementLog, queryStack); } else { return connection; } }
Example #3
Source File: BaseExecutor.java From mybatis with Apache License 2.0 | 5 votes |
protected Connection getConnection(Log statementLog) throws SQLException { Connection connection = transaction.getConnection(); if (statementLog.isDebugEnabled()) { //如果需要打印Connection的日志,返回一个ConnectionLogger(代理模式, AOP思想) return ConnectionLogger.newInstance(connection, statementLog, queryStack); } else { return connection; } }