ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ulrich Staudinger" <ustaudin...@gmail.com>
Subject How to avoid implicit transaction ?
Date Wed, 29 Nov 2006 14:56:21 GMT
Hi there,

despite the fact that ibatis is really very handy once you know how to use
it, i am wondering if i can avoid the implicit transaction it starts when i
want to read something from a datasource somehow.

Here is the output from my log:

1164808167.146 - INFO  "[getContact] 10" "-"
1164808167.146 - DEBUG Checked out connection 12159142 from pool. "-"
1164808167.146 - DEBUG {conn-100082} Connection "-"
1164808167.146 - DEBUG {conn-100083} Connection "-"
1164808167.185 - DEBUG "[getContact] fetched 16 values from db" "-"
1164808167.185 - DEBUG "[getContact] fetched  2 contact cards" "-"
1164808167.185 - DEBUG Returned connection 12159142 to pool. "-"

The problem is, that ibatis fetches a conncetion from the pool when i just
read something from the cache. How can i avoid this ? Since there are no SQL
statements in the debug log, it fetches information from the cache.

Now, when we disconnect the pc (on the network level) from the database
network, ibatis stops to work, although it should fetch stuff from the
cache. Actually ibatis throws an exception from somewhere inside transaction
management when you pull the wire.

Anyway, this checking out and returning of connections is in my case the
real performance problem.

Here are my configuration files:

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0
//EN"
    "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlMapConfig>
      <properties resource="database.properties"/>

  <settings
    cacheModelsEnabled="true"
    enhancementEnabled="true"
    maxSessions="64"
    maxTransactions="8"
    maxRequests="128"/>

  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="${driver}" name="JDBC.Driver"/>
      <property value="${url}" name="JDBC.ConnectionURL"/>
      <property value="${username}" name="JDBC.Username"/>
      <property value="${password}" name="JDBC.Password"/>
      <property value="15" name="Pool.MaximumActiveConnections"/>
      <property value="15" name="Pool.MaximumIdleConnections"/>
      <property value="1000" name="Pool.MaximumWait"/>

      <property name="useUnicode" value="true"/>
      <property name="characterEncoding" value="UTF-8"/>

      <!-- ping query -->
      <property name="Pool.PingQuery" value="select 1 from contact2"/>
      <property name="Pool.PingEnabled" value="true"/>
      <property name="Pool.PingConnectionsOlderThan" value="60000"/>
      <property name="Pool.PingConnectionsNotUsedFor" value="60000"/>

    </dataSource>
  </transactionManager>
  <sqlMap resource="Contact.xml" />


</sqlMapConfig>



<sqlMap namespace="Contact">

      <cacheModel id="contact-cache" type="FIFO">
      <flushInterval hours="2"/>
      <flushOnExecute statement="flushStatement"/>
      <property name="size" value="10000" />
    </cacheModel>
[...]


Does someone have an idea how to avoid that implicit transaction ?

Thanks,
best regards,
Ulrich

-- 
Ulrich B. Staudinger

Mime
View raw message