I think we need a little more information. I assume that the code you've prsented is a mocked up example - and everything looks right in your mock up.
Questions:
1. What is the method secondTask() doing? Hopefully no transaction stuff (like another start transaction or a commit).
2. What Exception is thrown from secondTask()?
3. By any chance, are DAO1 and DAO2 in different <context> elements in your dao.xml? From your mocked up code it doesn't look like they are, but also doesn't hurt to ask.
Jeff Butler
On 6/15/06, Debasish Dutta Roy <[EMAIL PROTECTED]> wrote:
offcourse it will be helpful if you could share what you did correctly, and if you could find something wrong in my approach. I am using Oracle 9i.
On 6/15/06, Tony Qian <[EMAIL PROTECTED]> wrote:Yes. It worked for me (MySQL).
Tony
Debasish Dutta Roy wrote on 6/15/2006, 11:09 AM:Hi All
Has anyone successfully tested rollback with DAOManager implementation.
I am unable to get it working.
I have a business delegate who does like this:
DAO1 dao1 = daoManager.getDAO(DAO1.class);
DAO2 dao2 = daoManager.getDAO(DAO2.class);
try {
daoManager.startTransaction ();
dao1.firstTask();
dao2.secondTask();
daoManager.commitTransaction();
} catch (Exception e) {
throw myException;
} finally {
daoManager.endTransaction ();
}
my dao.xml is like this
<context>
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource" value="xml/sql-map-config.xml "/>
</transactionManager>
...........
...........
</context>
and the corresponding sql-map-config.xml
<sqlMapConfig>
<transactionManager type="JDBC" commitRequired="true">
<dataSource type="JNDI">
<property name="DataSource" value="java:comp/env/jdbc/MyDataSource"/>
</dataSource>
</transactionManager>
