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 參數類型問題,應該是Map,結果報錯.2. java - mybatis的注解sql怎么設置返回類型和查詢參數,比如我要返回一個封裝好的類里面有map屬性的3. java - mybatis源碼分析4. java - mybatis 插入數據到oracle,id無法用selectkey獲取到數據5. java - Mybatis關聯查詢6. java - mybatis mysql 如何實現upsert功能?7. java - mybatis查詢的時間與mysql的時間不一致?8. java - mybatis怎么處理事務問題9. java - Mybatis 一對多怎么映射10. java - Mybatis插入mysql數據庫返回自增主鍵的問題?
