I am trying to add Ibatis persistence to struts , cannot use springs.
When daoManager.startTransaction(); how can we ensure that the JTA's transaction is being called and not the Ibatis Automatic transactions.


Meindert wrote:
Ibatis DAO has been depreciated.. Use spring instead

-----Original Message-----
From: ashok [mailto:[EMAIL PROTECTED] Sent: 29 June 2007 09:53 AM
To: ibatis
Subject: Global Transactions or Ibatis's Automatic transactions

Hi

Does the daoManger.startTransaction(); created refers to the Global transactions or Ibatis Automatic transactions?
What changes to be made if I need to use global transactions?

In my  DaoIntializer class  I create the daoManager as follows :

Reader reader = Resources.getResourceAsReader("com/example/config/dao.xml");
            daoManager = DaoManagerBuilder.buildDaoManager(reader);

and  dao.xml, sqlMapConfig.xml and web.xml contains the following enteries:

In my dao.xml :
<daoConfig>
    <context>
        <transactionManager type="SQLMAP">
            <property name="SqlMapConfigResource"
                value="com/example/config/sqlMapConfig.xml" />
        </transactionManager>

        <dao interface="com.example.ibatis.UserTableDao"
            implementation="com.example.ibatis.UserTableDaoImpl" />
    </context>
</daoConfig>

In my sqlMapConfig.xml

<sqlMapConfig>

    <settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" errorTracingEnabled="false" maxRequests="32" maxSessions="10" maxTransactions="5" useStatementNamespaces="false" />

    <transactionManager type="EXTERNAL">
<property name="UserTransaction" value="java:comp/env/UserTransaction"/>
      <property name="SetAutoCommitAllowed" value="false"/>
        <dataSource type="JNDI">
        <property name="DataSource" value="java:comp/env/jdbc/exampleDB" />
        </dataSource>
<sqlMap resource="com/example/ibatis/sqlMap/UserTable.xml" />
</sqlMapConfig>



In my web.xml :

    <resource-ref>
        <description>Example DBConnection</description>
        <res-ref-name>jdbc/exampleDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

    <resource-ref>
        <description>Example Transaction Manger</description>
        <res-ref-name>UserTransaction</res-ref-name>
        <res-type>javax.transaction.UserTransaction</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>



















Regards
Ashok



Reply via email to