ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Carchrae <carch...@gmail.com>
Subject Re: table name as parameter
Date Mon, 08 Feb 2010 20:05:32 GMT



>> 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: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message