I finally achieve success with my original SQLScript by patching ibatis instead of having to do convoluted things in my source code that I could not stand before a QA session. in file: ibatis-2.3.4.726\src\ibatis-src\com\ibatis\common\beans\ProbeFactory.java
in method: getProbe(), line: 33
replaced: return GENERIC;
by: return BEAN;

Hope this will make its way into the main build.

regards.


Poitras Christian wrote:
This is a bug in how iBATIS handles maps inside a list parameter.
Curiously, using #[].name# and #[].type# gave the expected result, but not 
$[].name$ and $[].type$...

You can use a simple patch by putting your list of maps inside a map:
    private Map<String, List<Map<String, String>>> prepareCreateTableParams(
            final String[] columnNames, final String[] columnTypes) {
        Map<String, List<Map<String, String>>> ret = new HashMap<String, 
List<Map<String, String>>>();
        List<Map<String, String>> params =
            new ArrayList<Map<String, String>>();
        for(int i = 0; i < columnNames.length; i++) {
            HashMap<String, String> map = new HashMap<String, String>();
            map.put("name", columnNames[i]);
            map.put("type", columnTypes[i]);
            params.add(map);
        }
        ret.put("list", params);
        return ret;
    }

And in xml:
    <statement id="create-table" parameterClass="map">
        CREATE TABLE data
            <iterate open="(" close=")" conjunction="," property="list">
                $list[].name$ $list[].type$
            </iterate>
    </statement>


This should work.

Christian


-----Original Message-----
From: Pascal Jacob [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 4:59 PM
To: user-java@ibatis.apache.org
Subject: Re: dynamic CREATE TABLE woe

Investigating more, I found the following evidences in the PreparedStatement 
sent by iBatis (I finally found the way to make iBatis log under SLF4J):

22:29:39.296 [DEBUG] [main] [java.sql.PreparedStatement:26] - {pstm-100002} 
Executing Statement:
CREATE TABLE seqnsdb.seqnsdata ( {name=ID, type=INTEGER} {name=ID, 
type=INTEGER}, {name=ARISING_SEQ_ID, type=INTEGER} {name=ARISING_SEQ_ID, 
type=INTEGER}, {name=AC_SERIAL_NO, type=VARCHAR(255)} {name=AC_SERIAL_NO, 
type=VARCHAR(255)} ... )

It is evident that iBatis is not transforming the SQLScript as expected !
It seems like the whole Map.Entry is printed each time instead of only the name 
value first then only the type value.
AAMOF I did replace $[].name$ and $[].type$ by simply  $[]$ in the script and 
get the exact same result, which confirms that $[].name$ don't do anything more 
than $[]$ which is obviously not what is expected (or there is something i 
didn't understood)

Hope this helps someone helping me ;)

Tanks in advance.

---------------------------------------------------------------------------------------
Orange vous informe que cet e-mail a ete controle par l'anti-virus mail. Aucun virus connu a ce jour par nos services n'a ete detecte.




Reply via email to