ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Voorhoeve, Niels {PBG}" <niels.voorho...@pepsi.com>
Subject RE: dynamic sql map
Date Wed, 11 Jan 2006 16:46:15 GMT
If you're asking the db server to create a prepared statement or stored
procedure with column names or table names as params, then it may not
work (definitely not in the case of table names).  I tried that with
oracle once to no avail. 

-----Original Message-----
From: Henry Lu [mailto:zhlu@umich.edu] 
Sent: Wednesday, January 11, 2006 11:15 AM
To: user-java@ibatis.apache.org
Subject: dynamic sql map

I got errors:

org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in 
task 'SqlMapClient operation'; nested exception is 
com.ibatis.common.jdbc.exception.NestedSQLException: --- The error 
occurred in edu/umich/med/umms/coreyp/dao/ibatis_map/misc.xml. --- The 
error occurred while applying a parameter map. --- Check the 
select_list-InlineParameterMap. --- Check the statement (query failed). 
--- Cause: java.sql.SQLException: ORA-00942: table or view does not

with the sql:

  <statement id="select_list"
    select $col_code$ as m_name,
           $col_descr$ as m_value
           FROM $my_table_name$

and java code:

      Map map = new HashMap(4);
      map.put("col_code", "STATE_ABBRV");
      map.put("col_descr", "STATE");
      map.put("my_table_name", "USSTATE_DESC");
         "ORDER BY STATE");
      return getSqlMapClientTemplate().queryForList(
               "select_list", map);

Is there anyone can help me out this?


Larry Meadors wrote:

>Vector myVector = new Vector(theList);
>On 1/11/06, Ashish Kulkarni <kulkarni_ash1312@yahoo.com> wrote:
>>I have defined a query as
>><select id="selectLinesFromView"
>>SELECT L083LINE FROM PL1083 WHERE L083CODE = #value#
>>and in my java code i do
>>List list = client.queryForList("selectLinesFromView",
>>Suppose if i want a Vector as output, i just cannot
>>parse it as it gives me classcastexception,
>>so what is a best way of getting Vector as output, or
>>do i have to iterate through list and uild my own
>>Do You Yahoo!?
>>Tired of spam?  Yahoo! Mail has the best spam protection around

View raw message