This mailing list is closed.  please use user-java@ibatis.apache.org

Clinton

On 9/28/05, Vijai Senthil Padmanabhan Kalaiyarasi <[EMAIL PROTECTED] > wrote:
Hi,
 
    I have included this piece of code before getting the DAO instance from DAOManager.
 
        SqlMapDaoTransaction trans = (SqlMapDaoTransaction) daoManager.getTransaction(daoManager.getDao(daoClass));
        SqlMapClient sqlMapClient = trans.getSqlMap();
        Connection conTemp = sqlMapClient.getDataSource().getConnection("test", "test");
        sqlMapClient.setUserConnection(conTemp);
 
        daoManager.getDao(daoClass);
 
    I thought of substituting the connection in the sqlmap with my own connection.
    But it gave me error like
 
    Cause: com.ibatis.sqlmap.engine.transaction.TransactionException: TransactionManager could not end this transaction.  A user provided connection     is currently being used by this session.  You must call the rollback() method of the Connection directly.  The calling .setUserConnection (null) will clear     the user provided transaction.
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:471)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:134)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:107)
 
    I have even tried supyling sqlMapClient.endTransaction() and sqlMapClient.commit() after the sqlMapClient.setU serConnection(conTemp) statement. But I got a error which goes like "commit() cannot be given when you use container-managed transactions".
    Is there any other round about to do this? So that the SQL statements will be executed with the user supplied connection.
 
Thanks and regards
Vijai Senthil P K

Reply via email to