在sql中,存在两种注释方式。
单行注释: --
多行注释:/**/
由于项目要求,就在sqlmap中都是用了单行注释。
但是在运行时候,发生了以下错误:
org.springframework.jdbc.InvalidResultSetAccessException: SqlMapClient operation; invalid ResultSet access for SQL []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in XXXXXXXXXX.xml.
--- The error occurred while applying a parameter map.
--- Check the sqlID-InlineParameterMap.
--- Check the parameter mapping for the 'XXXXXX' property.
--- Cause: java.sql.SQLException: 列索引が無効です。
查来查去没有头绪。
忽然发现,在控制台中,sql语句都打成了一行。
这样就导致,第一个单行注释就将后面所有的sql都注释掉了。
所以,在sqlmap中,使用多行注释比较靠谱。