I’m trying to get OracleConnection from glassfish by this lines:
EntityManager em = getEntityManager();
Connection c = em.unwrap(Connection.class);
But, in debugger I see that the actual class for c is ConnectionHolder40 class. Where I can find a jar with ConnectionHolder40 definition?
You can get only interfaces. If you use the Connection interface, you will get a first wrapper in hierarchy that implements Connection, so ConnectionHolder40 is that case.
If you want to get OracleConnection – and I see here that it is an interface, you should ask for it.
But you need a JDBC4 driver. With JDBC3 drivers you can have problems (as I have with Informix 3.70) because they do not implement unwrap and isWrapperFor methods and also ConnectionHolder40, *StatementWrapper40 and ResultSetWrapper40 are not implemented correctly.
If I want to unwrap IfmxConnection from holder, I can. But I cannot ask holder if he is a wrapper for IfmxConnection – it causes exception because it tries to ask the driver implementation: ConnectionHolder40 . StatementWrapper and ResultSetWrapper throw exception from both methods if they don’t directly implement interface (exactly, if you don’t ask for java.sql.*Statement resp. java.sql.ResultSet).