ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harvey Kim" <cash...@fastmail.fm>
Subject ibatis eating up memory
Date Fri, 14 Sep 2007 20:47:18 GMT
There seems to be a problem using "queryWithRowHandler" when the
resulting object returned contains a collection that requires a groupBy
clause.

Example:

  <resultMap id="blahMap" class="blahObject" >
      <result property="xxxxx" column="XXXXXXX"/>
      <result property="internalList" resultMap="blah.blahOtherMap"/>
  </resultMap>

  <resultMap id="blahOtherMap" groupBy="someId" class="someObject" >
      <result property="abc" column="ABC"/>
      .
      .
      .
      <result property="zzz" column="ZZZ"/>
  </resultMap>

getList  SELECT
      table.xxxxxx,
      jtable.abc,
      jtable.zzz
    FROM PNL table 
    LEFT JOIN join_table jtable
    ON (table.abc = join_table.abc)

Java code:

sqlMapClient.queryWithRowHandler("getList", someObject,
rowHandlerObject);  


rowHandlerObject's "handleRow".

  public void handleRow (Object valueObject)
  {
    try
    {
      Runtime r = Runtime.getRuntime(); 
      if (rowCount++ % 10000 == 0)
      {
        System.out.println("total memory and free memory is: " +
        r.totalMemory() + " : " + r.freeMemory());   
      }
    }
    catch (Exception e) 
    {
     e.printStackTrace();
    }
  }


As soon as I change "internalList" above to "internalObject" and get rid
of the groupBy, this thing can run forever.  If it stays as a list with
the "groupBy", the memory runs out really fast.

Any help will be appreciated.  If there is no solution soon, I will have
to resort to going back to using JDBC - which I've already implemented
and is working fine.

Thank You,

-Harvey

-- 
http://www.fastmail.fm - Does exactly what it says on the tin


Mime
View raw message