ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zarar Siddiqi" <zarar.sidd...@utoronto.ca>
Subject Re: problem with Ibatis returning correct number of rows
Date Wed, 13 Jul 2005 19:40:10 GMT
Are you sure your XXXXBean class is conforming to Java Bean standards?  You shouldn't be naming
your member variables "Id", they should be called "id" (what your db column happens to be
called), thus giving you getId() and setId() in your bean.


----- Original Message ----- 
  From: arun m 
  To: user-java@ibatis.apache.org 
  Sent: Wednesday, July 13, 2005 3:23 PM
  Subject: problem with Ibatis returning correct number of rows


  Hello there
                   we are implementing ibatis. In one scenario, the code is getting only one
row from the oracle database. I looked at the sql statement generated by Ibatis. The sql statement
gets 2 rows from the database where as Ibatis gets only one.

  Allow me to give the peice of code diong this.

  1. the map

  <resultMap id="getDetails" class="XXXXBean">
     <result property="Id" column="id" />      
     <result property="Amount" column="amount" />      
    </resultMap>

    <statement id="getDetailsbyId" resultMap="getDetails">
    select 
          id,
         amount
         from
      table       where id = #Id#   
        
    </statement>

  The java code used to call this is as follows

  ArrayList invoiceviews = (ArrayList) getSqlMapClientTemplate().queryForList("getDetailsbyId",
Id);

  I did not want to be too verbose in the email hence I shortened the code. I can share the
entire code, if anybody is interested. But the size of arraylist returned in the above code
is 1. The log4j log shows that Ibatis generates only one resultset for the query. But if I
execute the same query generated by Ibatis I get 2 rows in oracle db.

  Has anyone encountered this problem before ?

  Thanks
  Ram.



  __________________________________________________
  Do You Yahoo!?
  Tired of spam? Yahoo! Mail has the best spam protection around 
  http://mail.yahoo.com 

Mime
View raw message