2014-02-05 18 views
0

Java的春天的MyBatis我想createDescriptor,但我需要的原始連接,而不是「NewProxyConnection」可以有一個人幫助我,我怎樣才能得到Oracle連接對象去「NewProxyConnection」對象的的MyBatis如何獲得連接了NewProxyConnection的

我碰到方法proxyCon.rawConnectionOperation(arg0,arg1,arg2)但我不知道我是否可以使用它。任何幫助讚賞。

public class MarketListTypeHandler implements TypeHandler { 

// other override methods 



     public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException { 


       NewProxyConnection proxyCon = (NewProxyConnection) ps.getConnection(); 
        StructDescriptor structDescriptor = StructDescriptor.createDescriptor("mkt_list_rec", proxyCon); 
    // rest of the code goes here 


     } 


     } 

回答

0

找到解決方案,與大家分享。

C3P0NativeJdbcExtractor cp30NativeJdbcExtractor = new C3P0NativeJdbcExtractor(); 
    OracleConnection connection = (OracleConnection) cp30NativeJdbcExtractor.getNativeConnection(ps.getConnection());