You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "Jagels, Steve E." <SE...@magellanhealth.com> on 2005/03/02 20:28:43 UTC

transaction rolled back without going through catch{}

Any idea why a transaction gets rolled back but it does not produce any
error or go through the catch statement?  The identity field value gets
incremented but no record appears in a select statement.  I can run the
stored procedure with the values supplied just fine in SQL Server
Enterprise Manager.  

 

I have used both simple and DBCP datasource types with the same results.
We use connection pooling but it is not container managed.  There are
other pages of this application and other applications that are set up
in the same way (same sql config xml file, same way of calling the sql
map, etc.), and they do not experience this error.

 

> try {

>         sqlMap.startTransaction();

>         String necActionId = request.getParameter("necActionId");

>         if(necActionId != null){

>                 Recalc recalc = new Recalc();

>                 int nec = Integer.parseInt(necActionId);

>                 recalc.setNecActionId(nec);

>                 String reasonId = request.getParameter("reasonId");

>                 int rsnId = Integer.parseInt(reasonId);

>                 recalc.setReasonId(rsnId);

>                 int oldRequestId = Integer.parseInt(id);

>                 recalc.setRequestId(oldRequestId);

>                 String newRequest =

> (String)sqlMap.queryForObject("copyRecalc", recalc);

>         }

>         sqlMap.commitTransaction();

> } catch (Exception e) {

>         e.printStackTrace();

> } finally {

>         try {

>                 sqlMap.endTransaction();

>         } catch (Exception e) {

>                 e.printStackTrace();

>         }

> }

> 

 

 

 

 

<?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>

 

      <settings maxRequests="256"

            maxSessions="64"

            maxTransactions="16"

            cacheModelsEnabled="true"

            lazyLoadingEnabled="true"

            enhancementEnabled="true"           

      />

       

      <transactionManager type="JDBC">

<!--        <dataSource type="SIMPLE">    -->

            <dataSource type="DBCP">

                  <property name="JDBC.Driver"
value="com.jnetdirect.jsql.JSQLDriver" />

                  <property name="JDBC.ConnectionURL"
value="jdbc:JSQLConnect://myserver:1433/database=pqrst"/>

                  <property name="JDBC.Username" value="abc" />

                  <property name="JDBC.Password" value="xyz123" />

                  <property name="Pool.MaximumActiveConnections"
value="100" />

                  <property name="Pool.MaximumIdleConnections"
value="30" />

                  <property name="Pool.MaximumWait" value="60000" />

                  <property name="Pool.ValidationQuery" value="select 1"
/>

                  <property name="Pool.LogAbandoned" value="false" />

                  <property name="Pool.RemoveAbandoned" value="false" />

                  <property name="Pool.RemoveAbandonedTimeout"
value="50000" />

            </dataSource>

      </transactionManager>

      

      <sqlMap resource="com/mbh/esln/sra/sqlmaps/RequestSQL.xml"/>

</sqlMapConfig>

 

 

Steve Jagels

Sr. Programmer / Analyst

(314) 387-5131

sejagels@magellanhealth.com