private void postProcessStatement(Statement statement) throws SQLException { getResourceRegistry().register( statement ); }
private void postProcessStatement(Statement statement) throws SQLException { getResourceRegistry().register( statement ); }
private Object wrapIfNecessary(Object result, Object proxy, Method method) { if ( !( ResultSet.class.isAssignableFrom( method.getReturnType() ) ) ) { return result; } final ResultSet wrapper; if ( "getGeneratedKeys".equals( method.getName() ) ) { wrapper = ProxyBuilder.buildImplicitResultSet( ( ResultSet ) result, connectionProxyHandler, connectionProxy, ( Statement ) proxy ); } else { wrapper = ProxyBuilder.buildResultSet( ( ResultSet ) result, this, ( Statement ) proxy ); } getResourceRegistry().register( wrapper ); return wrapper; }
private Object wrapIfNecessary(Object result, Object proxy, Method method) { if ( !( ResultSet.class.isAssignableFrom( method.getReturnType() ) ) ) { return result; } final ResultSet wrapper; if ( "getGeneratedKeys".equals( method.getName() ) ) { wrapper = ProxyBuilder.buildImplicitResultSet( ( ResultSet ) result, connectionProxyHandler, connectionProxy, ( Statement ) proxy ); } else { wrapper = ProxyBuilder.buildResultSet( ( ResultSet ) result, this, ( Statement ) proxy ); } getResourceRegistry().register( wrapper ); return wrapper; }
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable { // handle the JDBC 4 Wrapper#isWrapperFor and Wrapper#unwrap calls // these cause problems to the whole proxy scheme though as we need to return the raw objects if ( "isWrapperFor".equals( method.getName() ) && args.length == 1 ) { return method.invoke( databaseMetaData, args ); } if ( "unwrap".equals( method.getName() ) && args.length == 1 ) { return method.invoke( databaseMetaData, args ); } try { boolean exposingResultSet = doesMethodExposeResultSet( method ); Object result = method.invoke( databaseMetaData, args ); if ( exposingResultSet ) { result = ProxyBuilder.buildImplicitResultSet( (ResultSet) result, connectionProxyHandler, connectionProxy ); connectionProxyHandler.getResourceRegistry().register( ( ResultSet ) result ); } return result; } catch ( InvocationTargetException e ) { Throwable realException = e.getTargetException(); if ( SQLException.class.isInstance( realException ) ) { throw connectionProxyHandler.getJdbcServices().getSqlExceptionHelper() .convert( ( SQLException ) realException, realException.getMessage() ); } else { throw realException; } } }
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable { // handle the JDBC 4 Wrapper#isWrapperFor and Wrapper#unwrap calls // these cause problems to the whole proxy scheme though as we need to return the raw objects if ( "isWrapperFor".equals( method.getName() ) && args.length == 1 ) { return method.invoke( databaseMetaData, args ); } if ( "unwrap".equals( method.getName() ) && args.length == 1 ) { return method.invoke( databaseMetaData, args ); } try { boolean exposingResultSet = doesMethodExposeResultSet( method ); Object result = method.invoke( databaseMetaData, args ); if ( exposingResultSet ) { result = ProxyBuilder.buildImplicitResultSet( (ResultSet) result, connectionProxyHandler, connectionProxy ); connectionProxyHandler.getResourceRegistry().register( ( ResultSet ) result ); } return result; } catch ( InvocationTargetException e ) { Throwable realException = e.getTargetException(); if ( SQLException.class.isInstance( realException ) ) { throw connectionProxyHandler.getJdbcServices().getSqlExceptionHelper() .convert( ( SQLException ) realException, realException.getMessage() ); } else { throw realException; } } }