You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "alex mccarrier (JIRA)" <ib...@incubator.apache.org> on 2004/12/02 23:15:22 UTC

[jira] Commented: (IBATIS-20) upgrading from old version defaults to wrong TransactionManager

     [ http://nagoya.apache.org/jira/browse/IBATIS-20?page=comments#action_56123 ]
     
alex mccarrier commented on IBATIS-20:
--------------------------------------

I think this is the source of the problem, in the compatibility libraries there is this XSL file:

com/ibatis/db/sqlmap/upgrade/SqlMapConfig.xsl

Which contains this template:

  <xsl:template match="datasource">
    <xsl:element name="transactionManager">
      <xsl:choose>
        <xsl:when test="//settings/@useGlobalTransactions='true'">
          <xsl:attribute name="type">JTA</xsl:attribute> <========================== this is wrong
          <xsl:element name="property">
            <xsl:attribute name="name">UserTransaction</xsl:attribute>
            <xsl:attribute name="value">
              <xsl:value-of select="//settings/@userTransactionJndiName"/>
            </xsl:attribute>
          </xsl:element>
        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="type">JDBC</xsl:attribute>
        </xsl:otherwise>

What this seems to be saying is that if useGlobalTransactions is 'true' then there will also be a userTransactionJndiName ... however, in the old format this is not always required, as in our case we are not using that sine we are not using User Managed Transactions.  I think what SHOULD be happening here is that there should be an option that says if userTransactionJndiName is "" then transactionManager/@type should be EXTERNAL.

> upgrading from old version  defaults to wrong TransactionManager
> ----------------------------------------------------------------
>
>          Key: IBATIS-20
>          URL: http://nagoya.apache.org/jira/browse/IBATIS-20
>      Project: iBatis for Java
>         Type: Bug
>  Environment: jboss 3.2.1, iBatis 2.0.8 (upgraded from iBatis 1.2.9)
>     Reporter: alex mccarrier

>
> We are using EJB to demarcate transactions.  Old iBatis sql config file contained this:
>     <settings useGlobalTransactions="true"
>               cacheModelsEnabled="true" />
>             <datasource name="snmDataSource"
> 	                factory-class="com.ibatis.db.sqlmap.datasource.JndiDataSourceFactory"
> 	                default="true" >
> 	                <property name="DBFullJndiContext" value="java:/DataSource" />
> 	    </datasource>
> Which configured iBatis to use external global transaction management, which from the documentation I understand this to be the default unless I specify to use Managed Global Transactions by including settings attribute called "userTransactionJndiName" (iBatis 1.2.9 manual, pp 39-40).
> When iBatis 2.0.8 tries to do the conversion, it defaults to Managed Global Transactions, then throws a ClassCastException because it can't find a UserTransaction object at jndi name "" (because there is none specified).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira