Details
Description
We have some code to imitate the DissociatableManagedConnection to avoid connection leaks that proxies connections from the supplied ManagedConnectionFactory: the proxy implements all the interfaces of the connection, but not the class itself. However, there's nothing stopping the ConnectionFactory from casting the (now proxied) connection to the implementation class it expects.
The TxConnect project at sourceforge illustrates this approach in the EisConnectionFactory.
http://txconnect.sourceforge.net
One possible solution would be to have a flag to turn on this proxying behavior. I don't immediately see a way to detect if the problem will occur.