I have some legacy JDBC code that is used within an EJB, in this code a call to setAutocommit() is made (which is not allowed for managed transactions, for understandable reasons).
I would like to skip this method call if the code is used within a managed transaction, but let the call remain if used in an un-managed context.
Is there a standardised way to detect if a JDBC Connection object is "managed" or not?