java - mybatis,調用存儲過程,“setselect”附近有語法錯誤。
問題描述
mybatis,調用存儲過程,“setselect”附近有語法錯誤。
<select resultMap='BaseResultMap' parameterType='com.unisits.zngkpt.framework.highwayreport.pojo.ReportType' statementType='CALLABLE'> {call Get_TrafficData_Report ( #{reportTimeType,mode=IN,jdbcType=VARCHAR},#{reportFunction,mode=IN,jdbcType=VARCHAR},#{year,mode=IN,jdbcType=INTEGER},#{month,mode=IN,jdbcType=INTEGER},#{day,mode=IN,jdbcType=INTEGER},#{tunnelId,mode=IN,jdbcType=INTEGER} )}</select>
把參數直接改成 ’Day’, ’JTLL’, 2015, 06, 15, 0就沒有問題。
完整log
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: ### Error querying database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: “setselect”附近有語法錯誤。### The error may exist in file [D:zngkptcodezngkptoutartifactshighway_war_explodedWEB-INFclassesmappersqlserverTrafficReportStatic.xml]### The error may involve com.unisits.zngkpt.framework.highwayreport.mapper.TrafficReportDao.getTrafficReportData-Inline### The error occurred while setting parameters### SQL: {call Get_TrafficData_Report ( ?, ?, ?, ?, ?, ? )}### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: “setselect”附近有語法錯誤。
問題解答
回答1:存儲過程報錯,直接把報錯的參數用來調試存儲過程就知道什么問題了
相關文章:
1. java - mybatis的注解sql怎么設置返回類型和查詢參數,比如我要返回一個封裝好的類里面有map屬性的2. java - Mybatis關聯查詢3. java - Mybatis:Mybatis能否直接返回一個二維數組(表)4. java - mybatis怎么實現在數據庫中有就修改,沒有就添加5. java - mybatis查詢的時間與mysql的時間不一致?6. java - Mybatis 數據庫多表關聯分頁的問題7. java - Mybatis插入mysql數據庫返回自增主鍵的問題?8. java - mybatis執行sql求和問題9. java - mybatis里的REGEXP10. java - Mybatis查詢數據庫時出現查詢getInt()的錯誤
