Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 76971 invoked from network); 1 Dec 2005 10:56:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Dec 2005 10:56:42 -0000 Received: (qmail 85034 invoked by uid 500); 1 Dec 2005 10:56:41 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 84631 invoked by uid 500); 1 Dec 2005 10:56:40 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 84620 invoked by uid 99); 1 Dec 2005 10:56:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2005 02:56:39 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of flex2004@gmail.com designates 66.249.82.205 as permitted sender) Received: from [66.249.82.205] (HELO xproxy.gmail.com) (66.249.82.205) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Dec 2005 02:58:06 -0800 Received: by xproxy.gmail.com with SMTP id s18so147146wxc for ; Thu, 01 Dec 2005 02:56:15 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=VX8MLhX3u+UB39ftpU0ukjQzN9jV+qYvPyWGmLBXBjIs5A5f8pDxFPEUxfIeRhLGno/iymxiSdi0e+T2gvbEB67Hy9h26siFFyNpqIpDBxbl7tlvEhhyXvSiMNTH6MMAySsGFxBm5RELd2nyny2xfPD3zEszLKhB2ehE1Z9CyNE= Received: by 10.70.46.13 with SMTP id t13mr1711614wxt; Thu, 01 Dec 2005 02:56:15 -0800 (PST) Received: by 10.70.82.11 with HTTP; Thu, 1 Dec 2005 02:56:15 -0800 (PST) Message-ID: Date: Thu, 1 Dec 2005 16:26:15 +0530 From: Sathish S To: user-java@ibatis.apache.org Subject: Reg queryForList (returns back a list of empty objects) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_20454_5998509.1133434575746" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_20454_5998509.1133434575746 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi All, I wanted to query an unknown table at the runtime ie the user will select a table from the list of tables (These tables are created dynamicall= y at the runtime and I am not sure about the table definition) and would like to see the records. I am using the method queryForList("statementName", tableNameParameter). But the list that this method returns back is a list o= f empty objects (even though the size of the list is equal to the number of records available in the table). Though queryForMap returns me the data, I cannot use queryForMap because I am not sure about the columnName that can be used for keyParameter (I might not get all the records if that columnNam= e has duplicate values as the records might get overwritten in the Map). I have attached my sample code and output in this mail. Can anyone tell me what's wrong in my code or any workaround? I am usin= g iBatis version 2.1.5 GA. SQLMap: -------------- Code: --------- public List fetchData(String tableName) throws SomeCustomException { logger.debug("Before Execution"); List list =3D queryForList("getDataList", tableName); logger.debug("After Execution"); logger.debug("Result -> " + list.toString()); return list; } O/P: ------- 2005-12-01 16:12:29,714 DEBUG [ com.aspect.eds.dao.datamap.DataCompareSqlMapDao] - Before Execution ( DataCompareSqlMapDao.java:fetchData:38) 2005-12-01 16:12:29,792 DEBUG [com.ibatis.common.jdbc.SimpleDataSource] - Created connection 2868213. (Log4jImpl.java:debug:22) 2005-12-01 16:12:29,792 DEBUG [java.sql.Connection] - {conn-100005} Connection (Log4jImpl.java:debug:22) 2005-12-01 16:12:29,792 DEBUG [java.sql.PreparedStatement] - {pstm-100006} PreparedStatement: Select * from resource..Server ( Log4jImpl.java:debug:22) 2005-12-01 16:12:29,792 DEBUG [java.sql.PreparedStatement] - {pstm-100006} Parameters: [] (Log4jImpl.java:debug:22) 2005-12-01 16:12:29,792 DEBUG [java.sql.PreparedStatement] - {pstm-100006} Types: [] (Log4jImpl.java:debug:22) 2005-12-01 16:12:29,807 DEBUG [java.sql.ResultSet] - {rset-100007} ResultSe= t (Log4jImpl.java:debug:22) 2005-12-01 16:12:29,807 DEBUG [ com.aspect.eds.dao.datamap.DataCompareSqlMapDao] - After Execution ( DataCompareSqlMapDao.java:fetchData:40) 2005-12-01 16:12:29,807 DEBUG [ com.aspect.eds.dao.datamap.DataCompareSqlMapDao] - Result -> [[], [], [], [], [], [], [], []] (DataCompareSqlMapDao.java:fetchData:41) 2005-12-01 16:12:29,839 DEBUG [com.ibatis.common.jdbc.SimpleDataSource] - Returned connection 2868213 to pool. (Log4jImpl.java:debug:22) -- Thanks, Sathish S ------=_Part_20454_5998509.1133434575746 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi All,
    I wanted to query an unknown table at the runtime ie the user will select a table from the list of tables (These tables are created dynamically at the runtime and I am not sure about the table definition) and would like to see the records. I am using the method queryForList("statementName", tableNameParameter). But the list t= hat this method returns back is a list of empty objects (even though the size of the list is equal to the number of records available in the table). Though queryForMap returns me the data, I cannot use queryForMap because I am not sure about the columnName that can be used for keyParameter (I might not get all the records if that columnName has duplicate values as the records might get overwritten in the Map). I have attached my sample code and output in this mail.
    Can anyone tell me what's wrong in my code or any workar= ound? I am using iBatis version 2.1.5 GA.

SQLMap:
--------------
<?xml version=3D"1.0" encoding=3D"UTF-8" standalone= =3D"no"?>
<!DOCTYPE sqlMap
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN&q= uot;     
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">
   
<sqlMap namespace=3D"MultiSiteDataCompare">

  <select id=3D"getDataList" resultClass=3D"java.uti= l.List" parameterClass=3D"string">
    Select * from $value$
  </select>
</sqlMap>


Code:
---------
    public List fetchData(String tableName) throws SomeCusto= mException
    {
        logger.debug("Before Execut= ion");
        List list =3D queryForList("= ;getDataList", tableName);
        logger.debug("After Executi= on");
        logger.debug("Result -> = " + list.toString());
        return list;
    }


O/P:
-------
2005-12-01 16:12:29,714 DEBUG [com.aspect.eds.dao.datamap.DataCompareSqlMapDao] - Before Execution (DataCompareSqlMapDao.java:fetchData:38)
2005-12-01 16:12:29,792 DEBUG [com.ibatis.common.jdbc.SimpleDataSource] - C= reated connection 2868213. (Log4jImpl.java:debug:22)
2005-12-01 16:12:29,792 DEBUG [java.sql.Connection] - {conn-100005} Connect= ion (Log4jImpl.java:debug:22)
2005-12-01 16:12:29,792 DEBUG [java.sql.PreparedStatement] - {pstm-100006} = PreparedStatement:      Select * from resource..Server &n= bsp;  (Log4jImpl.java:debug:22)
2005-12-01 16:12:29,792 DEBUG [java.sql.PreparedStatement] - {pstm-100006} = Parameters: [] (Log4jImpl.java:debug:22)
2005-12-01 16:12:29,792 DEBUG [java.sql.PreparedStatement] - {pstm-100006} = Types: [] (Log4jImpl.java:debug:22)
2005-12-01 16:12:29,807 DEBUG [java.sql.ResultSet] - {rset-100007} ResultSe= t (Log4jImpl.java:debug:22)
2005-12-01 16:12:29,807 DEBUG [com.aspect.eds.dao.datamap.DataCompareSqlMapDao] - After Execution (DataCompareSqlMapDao.java:fetchData:40)
2005-12-01 16:12:29,807 DEBUG [com.aspect.eds.dao.datamap.DataCompareSqlMapDao] - Result -> [[], [], [], [], [], [], [], []] (DataCompareSqlMapDao.java:fetchData:41)
2005-12-01 16:12:29,839 DEBUG [com.ibatis.common.jdbc.SimpleDataSource] - Returned connection 2868213 to pool. (Log4jImpl.java:debug:22)



--
Thanks,
Sathish S ------=_Part_20454_5998509.1133434575746--