ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vijai Senthil Padmanabhan Kalaiyarasi" <vijaisenthil.padmanab...@kumaran.com>
Subject Passing logged in Username and password to iBATIS
Date Wed, 28 Sep 2005 20:07:17 GMT
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
Mime
View raw message