ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Corneliu Rudeanu <crude...@yahoo.com>
Subject Transaction trouble
Date Mon, 14 Nov 2005 09:58:33 GMT

My intention is to mix SQL Mapper statements with DAO accesses in the
same transaction. My code could look like this:

sqlMapClient.startTransaction();
sqlMapClient.update("updateUser", theUser);
daoManager.getDao(UserDAO.class).load(theUser);
sqlMapClient.commitTransaction();
sqlMapClient.endTransaction();

with:
public class UserDAOImpl extends SqlMapDaoTemplate implements UserDAO {
    public User load(String id) throws DaoException {
        return (UserTag) queryForObject("loadUser", id);
    }
}

DaoManager is configured like this:
<daoConfig>
    <context>
        <transactionManager type="SQLMAP">
            <property name="SqlMapConfigResource"
value="some/domain/sql-map-config.xml"/>
        </transactionManager>
        <dao interface="some.domain.UserTagDAO"
implementation="some.domain.UserDAOImpl"/>
    </context>
</daoConfig>

sql-map-config.xml is used to build sqlMapClient. This way, I intended
that both sqlMapClient and daoManager to share the same
connection/transaction. But the code proves that they are not: the
update made via sqlMapClient is not read via DAO. Splitting the two
calls in separate transactions (with a commit after the first update)
works ok.

Please advise me: what am I missing? What should I do to get the
sqlMapClient and daoManager share the same transaction?

Thanks in advance,
Corneliu Rudeanu


		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

Mime
View raw message