Hello Steven, thanks for the reply. I am running MySql. At the mysql prompt a: 
select @@autocommit displays a 1. And, the show variables displays: autocommit 
as ON. In my applicationContext.xml the bean property: defaultAutocommit = 
true. The various gory xml configs and source code follows. Only the 
transactions do not work. All query testcases pass. Thanks and please advise, 
David.



*********************************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:aop="http://www.springframework.org/schema/aop"; 
xmlns:context="http://www.springframework.org/schema/context";
       xmlns:tx="http://www.springframework.org/schema/tx";
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-2.5.xsd
            http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
            http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd";>

    <!-- Configurer that replaces ${...} placeholders with values from a 
properties file -->
    <context:property-placeholder location="classpath:jdbc.properties"/>
    
    <!-- Enable @Transactional support -->
    <tx:annotation-driven/>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" 
destroy-method="close">
        <property name="driverClassName" value="${driverClass}"/>
        <property name="url" value="${databaseURL}"/>
        <property name="username" value="${username}"/>
        <property name="password" value="${password}"/>
        <property name="maxActive" value="30"/>
        <property name="maxIdle" value="10"/>
        <property name="maxWait" value="1000"/>
        <property name="defaultAutoCommit" value="true"/>
    </bean>

    <!-- Transaction manager for iBATIS DAOs -->
    <bean id="transactionManager" 
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <!-- SqlMap setup for iBATIS Database Layer -->
    <bean id="sqlMapClient" 
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:sqlMap-config.xml"/>
    </bean>

        <bean class="com.sexingtechnologies.st.dao.BullmasterDaoIbatis" >
                <property name="sqlMapClient" ref="sqlMapClient"/>
        </bean>

        <bean class="com.sexingtechnologies.st.dao.AnimalmasterDaoIbatis" >
                <property name="sqlMapClient" ref="sqlMapClient"/>
        </bean>

</beans>
*********************************************************************************


*********************************************************************************
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" 
"http://ibatis.apache.org/dtd/sql-map-2.dtd"; >
<sqlMap namespace="animalmaster" >
  <typeAlias alias="animalmaster" 
type="com.sexingtechnologies.st.data.Animalmaster" />
  <resultMap id="animalmaster_ResultMap" class="animalmaster" >
    <result column="_class"             property="_class"                       
jdbcType="CHAR" />
    <result column="animalId"           property="animalId"             
jdbcType="LONG" />
    <result column="AnimalBreedId"      property="animalBreedId"        
jdbcType="LONG" />
  </resultMap>

  <sql id="animalid_Where_Clause" >
                where animalid = #animalId:LONG#
  </sql>

  <sql id="class_value_Where_Clause" >
                where _class = #_class:CHAR#
  </sql>
 
  <sql id="AnimalBreedId_value_Where_Clause" >
                where AnimalBreedId = #AnimalBreedId:LONG#
  </sql>

  <select id="selectAll" resultMap="animalmaster_ResultMap" 
parameterClass="animalmaster" >
    <!--
      Select all records
    -->
    select _class, animalId, AnimalBreedId
    from animalmaster
  </select>

  <select id="selectByPrimaryKey" resultMap="animalmaster_ResultMap" 
parameterClass="java.lang.Long" >
    <!--
      Select by primary key
    -->
    select _class, animalId, AnimalBreedId
    from animalmaster
    <isParameterPresent >
      <include refid="animalmaster.animalid_Where_Clause" />
    </isParameterPresent>
  </select>
  
  <select id="selectByPrimaryKeyAndClass" resultMap="animalmaster_ResultMap" 
parameterClass="java.lang.Long" >
    <!--
      Select by primary key
    -->
    select _class, animalId, AnimalBreedId
    from animalmaster
    where _class = #_class:CHAR#
      and animalId = #animalId:LONG#
  </select>

  <delete id="deleteByPrimaryKey" parameterClass="java.lang.Long" >
    <!--
      Delete by primary key
    -->
    delete from animalmaster
    where _class = #_class:CHAR#
      and animalId = #animalId:LONG#
  </delete>
  
  <delete id="deleteByAnimalBreedId" parameterClass="animalmaster" >
    <!--
      Delete by AnimalBreedId where clause
    -->
    delete from animalmaster
    <include refid="animalmaster.AnimalBreedId_value_Where_Clause" />
  </delete>
  
  <insert id="insert" parameterClass="animalmaster" >
    <!--
      Insert using values
    -->
    insert into animalmaster (_class, animalId, AnimalBreedId)
    values (#_class:CHAR#, #animalId:LONG#, #animalBreedId:LONG#)
  </insert>
  
  <insert id="insertSelective" parameterClass="animalmaster" >
    <!--
      Selective insert
    -->
    insert into animalmaster
    <dynamic prepend="(" >
      <isNotNull prepend="," property="_class" >
        _class
      </isNotNull>
      <isNotNull prepend="," property="animalId" >
        animalId
      </isNotNull>
      <isNotNull prepend="," property="animalBreedId" >
        AnimalBreedId
      </isNotNull>
      )
    </dynamic>
    values
    <dynamic prepend="(" >
      <isNotNull prepend="," property="_class" >
        #_class:CHAR#
      </isNotNull>
      <isNotNull prepend="," property="animalId" >
        #animalId:LONG#
      </isNotNull>
      <isNotNull prepend="," property="animalBreedId" >
        #animalBreedId:LONG#
      </isNotNull>
      )
    </dynamic>
  </insert>

  <select id="countByAnimalBreedId" resultClass="java.lang.Integer" >
    <!--
      Count all records against AnimalBreedId where clause
    -->
    select count(*) from animalmaster
    <include refid="animalmaster.AnimalBreedId_value_Where_Clause" />
  </select>
  
  <select id="countAllRecs" resultClass="java.lang.Integer">
                <!--
                        Count all records
                -->
                select count(*) from animalmaster
  </select>

  <update id="updateByAnimalId" >
    <!--
      Update by animal ID
    -->
    update animalmaster
    <dynamic prepend="set" >
      <isNotNull prepend="," property="record._class" >
        _class = #record._class:CHAR#
      </isNotNull>
      <isNotNull prepend="," property="record.animalId" >
        animalId = #record.animalId:LONG#
      </isNotNull>
      <isNotNull prepend="," property="record.animalBreedId" >
        AnimalBreedId = #record.animalBreedId:LONG#
      </isNotNull>
    </dynamic>
    <isParameterPresent >
      <include refid="animalmaster.animalid_Where_Clause" />
    </isParameterPresent>
  </update>

  <update id="updateByClass" >
    <!--
      Update by _class value
    -->
    update animalmaster
    set _class = #record._class:CHAR#,
      animalId = #record.animalId:LONG#,
      AnimalBreedId = #record.animalBreedId:LONG#
    <isParameterPresent >
      <include refid="animalmaster.class_value_Where_Clause" />
    </isParameterPresent>
  </update>

  <update id="updateByPrimaryKey" parameterClass="animalmaster" >
    <!--
      Update by primary key (same as animal ID above maybe needs to changed.)
    -->
    update animalmaster
    <dynamic prepend="set" >
      <isNotNull prepend="," property="animalBreedId" >
        AnimalBreedId = #animalBreedId:LONG#
      </isNotNull>
    </dynamic>
    where _class = #_class:CHAR#
      and animalId = #animalId:LONG#
  </update>

  <update id="updateByPrimaryKeyAndClassValue" parameterClass="animalmaster" >
    <!--
      Update by animal ID primary key and _class value where clause
    -->
    update animalmaster
    set AnimalBreedId = #animalBreedId:LONG#
    where _class = #_class:CHAR#
      and animalId = #animalId:LONG#
  </update>
</sqlMap>
*********************************************************************************


*********************************************************************************
Two transactions that do nothing
*********************************************************************************
        @Rollback @Transactional @Test
        public void testInsertAnimals() {
                animalMaster = new Animalmaster();
                animalMaster.setAnimalBreedId((long)104);
                animalMaster.setAnimalId((long)0);
                animalMaster.set_class("mammalia");
                animalmasterDao.insert(animalMaster);
        }

        @Rollback @Transactional @Test
        public void testUpdateAnimals() {

                animalMaster = new Animalmaster();
                animalMaster.setAnimalId((long)2881);
                animalMaster.set_class("mammalia");
                animalMaster.setAnimalBreedId((long)89);

                animalmasterDao.update(animalMaster);

                animalMaster = animalmasterDao.selectByPrimaryKey((long)2881);

                assertNotNull(animalMaster);

                assertEquals((long)2881, (long)animalMaster.getAnimalId());
                assertEquals("mammalia", animalMaster.get_class());
                assertEquals((long)89, (long)animalMaster.getAnimalBreedId());
        }
*********************************************************************************




----- Original Message -----
From: "Steven A" <traderj1...@gmail.com>
To: user-java@ibatis.apache.org
Cc: "larry meadors" <larry.mead...@gmail.com>
Sent: Monday, July 6, 2009 10:44:25 AM GMT -06:00 US/Canada Central
Subject: Re: JUnit DAO queries test OK but JUnit DAO non-queries are a  mystery?

David,

Rather than have us guess at your problem, be a little more helpful and post
some code, as well as your configuration.

Try setting jdbc autocommit to true.  That should clear up your problem....



On Mon, Jul 6, 2009 at 7:21 AM, David Brown
<dbr...@sexingtechnologies.com>wrote:

> Hello Larry, thanks for the speedy reply. I am not a long time iBatis user
> and therefore lack considerable background. Notwithstanding, I am not sure
> of your reply: Transactions? On the software side I have the non-query
> testcases annotated: @Transactional. On the database side I am using the
> MySql transactional engine: innodb. I have studied the output of the MySql
> command: show innodb status but nothing under transactions or the queries
> categories shows anything of interest. Please try to be more specific for
> the uninitiated.
>
> Regards, David.
>
>
>
> ----- Original Message -----
> From: "Larry Meadors" <larry.mead...@gmail.com>
> To: user-java@ibatis.apache.org
> Sent: Sunday, July 5, 2009 10:49:15 PM GMT -06:00 US/Canada Central
> Subject: Re: JUnit DAO queries test OK but JUnit DAO non-queries are a
>  mystery?
>
> Transactions? That's my guess.
>
> Larry
>
>
> On Sun, Jul 5, 2009 at 7:51 PM, David
> Brown<dbr...@sexingtechnologies.com> wrote:
> > Hello iBatis dev, gurus, users and mortals, I have a very curious
> situation with 6 testcase methods: 4 queries and 2 non-query. The 4 queries
> are some form of select against a where clause and an Integer ID and the
> same as: select count(*) where ... The asserts for all the queries pass. On
> the other hand the non-queries: 1 insert and 1 update don't fail either but
> inspection of the database records show no change. Any ideas on how to
> diagnose please advise, David.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
> > For additional commands, e-mail: user-java-h...@ibatis.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
> For additional commands, e-mail: user-java-h...@ibatis.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to