I would double check that you are not sending in null as the table name.
On Feb 8, 2010, at 1:05 PM, Tom Carchrae wrote:
>
>
>
>>> I am trying to load a table using a parameter to specify the table name:
>>>
>>> <select id="selectAllFromTable" parameterType="String"
>>> resultType="hashmap">
>>> select * from #{id}
>>> </select>
>>>
>>>
>> select * from ${id}
>>
>
> Thank you for the fast reply. I'm now onto a new error:
>
> ERROR main Slf4jImpl.error - Error calling Connection.prepareStatement:
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "null" at line
> 1, column 15.
> at
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown
> Source)
>
>
> My mapper interface is:
>
> List<Map> selectAllFromTable(RowBounds rowBounds, String tableName);
>
> And I am calling it with:
>
> String tableName = "Table";
> List<Map> rows = mapper.selectAllFromTable(rowBounds, tableName);
>
> Any further ideas?
>
> Thanks,
>
> Tom
>
>
> --
> View this message in context:
> http://old.nabble.com/table-name-as-parameter-tp27505213p27505434.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
Nathan Maves
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]