From: Bertrand R. <ber...@mo...> - 2004-03-18 23:45:25
|
> > > ==> A quick solution might be to change the code so the returned proxy > > implements *all* interfaces implemented by the *real* connection. > > Do you know, I think that might just work... > Nope... Cause before the ProxyConnection is returned to the user, it is wrapped by another proxy (at least in the current version - don't know in your rewite for dispoable wrapper). This second wrapping is made by calling the following code: /** * Get a Connection from the ProxyConnection * * @param proxyConnection where to find the connection * @return */ protected static Connection getConnection(ProxyConnectionIF proxyConnection) { return (Connection) Proxy.newProxyInstance( Connection.class.getClassLoader(), new Class[]{Connection.class}, (InvocationHandler) proxyConnection); } So the new proxy will implement java.sql.Connection only. BUT ... The ProxyConnection instance held inside proxool implements *all* interface of the *real* connection... The same stragey should be used for the one returned to the user. |