org.springframework.jdbc.UncategorizedSQLException: Error setting null parameter.



工具:STS

錯誤:------- 就是設置的參數爲NULL了

org.springframework.jdbc.UncategorizedSQLException: Error setting null parameter.  Most JDBC drivers require that the JdbcType must be specified for all nullable parameters. Cause: java.sql.SQLException: 無效的列類型: 1111
; uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 無效的列類型: 1111; nested exception is java.sql.SQLException: 無效的列類型: 1111


xml: //我這是動態賦值的,列字段也是不固定的

<insert id="saveValues" parameterType="String">
  <![CDATA[
          INSERT INTO ${sdeUserName}.${sdeLayerName}(objectid,#{file}) values (V_BOOKMARK_SEQ.nextVal,${upSql})
    ]]>
 </insert>


錯誤的DAO:   public void saveValues(String sdeUserName,String sdeLayerName,String file, String upSql);

正確的DAO:   public void saveValues(@Param("sdeUserName") String sdeUserName,    @Param("sdeLayerName") String     sdeLayerName,   @Param("file") String file,@Param("upSql") String upSql);

不加@Param關鍵字,xml參數就收不到數據

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章