现象:将Druid配置多数据源之后,原来没问题的sql语句,报错 sql injection violation, not terminal sql, token COMMENT。
原因:暂不知道,欢迎被指导。猜测是关键词被使用了。
问题的那一句sql:
<if test="columns!=null and columns !='' and columns.contains('comment')">
,(SELECT comment FROM session_comment WHERE type = 2 AND sessionId = a.sessionId )comment
</if>
解决方案:
将关键字comment用反引号包起来。 (~键那个)·。
<if test="columns!=null and columns !='' and columns.contains('comment')">
,(SELECT `comment` FROM session_comment WHERE type = 2 AND sessionId = a.sessionId )`comment`
</if>