[ http://nagoya.apache.org/jira/browse/IBATIS-3?page=history ]
Clinton Begin closed IBATIS-3:
------------------------------
Assign To: Clinton Begin
Resolution: Fixed
Fix Version: 2.0.8
Use <transactionManager type="..." commitRequired="true">. This will force
commit even on query, and hopefully clear the transaction properly for updates
after a query.
> Can't Update after Query with JTA transcation
> ---------------------------------------------
>
> Key: IBATIS-3
> URL: http://nagoya.apache.org/jira/browse/IBATIS-3
> Project: iBatis for Java
> Type: Bug
> Components: SQL Maps
> Reporter: Clinton Begin
> Assignee: Clinton Begin
> Fix For: 2.0.8
>
> When I execute "update" after "select", data can't insert
> into DB. But when I execute "insert" before "select", it
> works. I think it's the problem about transcation. Can
> anyone help me?
> MyCode:
> ==========================================
> Reader reader = Resources.getResourceAsReader
> ("com/bnslink/resources/sql-map-dao.xml");
> DaoManager manager =
> DaoManagerBuilder.buildDaoManager(reader);
> XCaseDao xcaseDao = (XCaseDao)manager.getDao
> (XCaseDao.class);
> XCase xcase = xcaseDao.getXCase(new Integer(1));
> manager.startTransaction();
> xcaseDao.inserXCase(new Integer(12345678));
> xcaseDao.updateXCase(new Integer(2222));
> manager.commitTransaction();
> manager.endTransaction();
> ==========================================
> can't insert XCase Table.
> My xml ,Ex:
> ==========================================
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD
> SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-
> map-config-2.dtd">
> <sqlMapConfig>
> <transactionManager type="JTA" >
> <property name="UserTransaction"
> value="javax.transaction.UserTransaction"/>
> <dataSource type="JNDI">
> <property name="DataSource"
> value="oracleDataSource"/>
> </dataSource>
> </transactionManager>
> <sqlMap resource="com/bnslink/resources/XCase.xml"/>
> </sqlMapConfig>
> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL
> Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-
> 2.dtd">
> <sqlMap namespace="XCase" >
> <select id="getXCase" parameterClass="int"
> resultClass="com.ibatis.dao.bean.XCase" >
> SELECT CASE_INDEX as caseIndex,
> OWNER_INDEX as ownerIndex,
> CREATE_DATE createDate
> FROM XCASE where case_Index = #value# </select>
> <insert id="insertXCase" parameterClass="int" >
> INSERT INTO TBCN.XCASE (
> CASE_INDEX)
> VALUES ( #value# )
> </insert>
> <update id="updateXCase" parameterClass="int" >
> Update XCase set OWNER_INDEX = 1 where
> case_index=#value#
> </update>
> </sqlMap>
> ==========================================
> Environment:
> weblogic8.1SP3
> oracle9i
> windowXP
> JDK1.4
--
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