[ 
https://issues.apache.org/jira/browse/IBATIS-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12642942#action_12642942
 ] 

pascal jacob commented on IBATIS-550:
-------------------------------------

A very simple patch in the iBatis source code resolved this issue:

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;



> $[].xxx$ expressions are not interpreted correctly
> --------------------------------------------------
>
>                 Key: IBATIS-550
>                 URL: https://issues.apache.org/jira/browse/IBATIS-550
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.3.4
>            Reporter: pascal jacob
>
> I encountered a 'com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException' 
> while executing the following SQL script:
>    <statement id="create-table" parameterClass="list">
>        CREATE TABLE data
>            <iterate open="(" close=")" conjunction=",">
>                $[].name$ $[].type$
>            </iterate>
>    </statement>
> The java code that prepare the list parameter and execute the SQL script is 
> as follow:
>    ...
>    sqlMapClient.startTransaction();
>    sqlMapClient.update("create-table", prepareCreateTableParams());
>    sqlMapClient.commitTransaction();
>    ...
>    private List<Map<String, String>> prepareCreateTableParams(
>            final String[] columnNames, final String[] columnTypes) {
>        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);
>        }
>        return params;
>    }
> and the exception was:
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred while applying a parameter map.
> --- Check the create-seqnsdata-table-InlineParameterMap.
> --- Check the statement (update failed).
> --- Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
> You have an error in your SQL syntax; check the manual that corresponds
> to your MySQL server version for the right syntax to use near '     ,         
>  ,          ,          ,          ,          ,          ,   '
> at line 1
>    at 
> com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:457)
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update(SqlMapSessionImpl.java:90)
>    at 
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.update(SqlMapClientImpl.java:66)
>    at net.eads.iw.seqns.CsvJdbcInjector.inject(CsvJdbcInjector.java:117)
>    ... 1 more
> It seems that iBatis is not correctly replacing $[].name$ and $[].type$ by 
> the value supplied in the list of map of string, string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to