We have a production application that is periodically returning an error from a 
query.  In fact, the user refreshes the page and the same query runs fine.  The 
query takes a hashmap as a parameter and returns an ArrayList of hashmaps.  
When we examine the logs, in which we can see the query and the jdbc parameters 
and resultsets, the parameters and query are identical between calls, except 
the first call fails.

The mapping query is like this:
<select id="getDatabaseRows" paramClass="map" resultClass="java.util.HashMap">
   select c.descrip
           , sum(v.item_count) as count
     from table1 v
         , table2 c
    where v.id = #id#
      and v.codeid=c.codeid
   group by c.descrip
 </select>


The call is like:
  HashMap params = new HashMap();
  params.add( "id", new Long("123");
  List result = (ArrayList) sqlMap.queryForList("Namespace.getDatabaseRows", 
params );

If we cut&paste the query that is failing into other tools, like SQL*Plus, or 
TOAD for Oracle, it runs fine.  In fact, if we step it, it runs fine.  Today, 
out of the 70 times it executed, it failed 4 times.  The user refreshed the 
page each time and the query ran without error.

Is there anything we can do to track down what is happening here?  It seems 
like the parameter must be somehow read/treated as a character on the first 
call which would make it fail, but we see in the log that it's a 
java.lang.Long.  If it helps, we are in a Java 1.4.2 environment under ORacle 
Application Server 10.1.2.1, and the iBATIS version is 2.1.7.597.  The backend 
database is Oracle 10G Release 2 10.2.0.3 I think.

Thanks for any help,
Eric

Reply via email to