在sql中,存在两种注释方式。java
单行注释: -- spring
多行注释:/**/sql
因为项目要求,就在sqlmap中都是用了单行注释。app
可是在运行时候,发生了如下错误:code
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: 列索引が無効です。
查来查去没有头绪。xml
突然发现,在控制台中,sql语句都打成了一行。索引
这样就致使,第一个单行注释就将后面全部的sql都注释掉了。io
因此,在sqlmap中,使用多行注释比较靠谱。jdbc