在使用JSONObject.fromObject的时候,出现“There is a cycle in the hierarchy”异常. 意思是出现了死循环,也就是Model之间有循环包含关系: 解决办法: 使用setCycleDetectionStrategy防止自包含 代码: JsonConfig jsonConfig=new JsonConfig(); jsonConfig.setIgnoreDefaultExcludes(false); jsonConfig.se…
问题描述:在使用mybatis对数据库执行更新操作时,parameterType为某个具体的bean,而bean中传入的参数为null时,抛出异常如下:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=’khzx’, m…
在mysql中,一个数字加上null,结果为null. 这个问题是我用update语句时遇见的,就像下边的例子 update tableName set number = number + x 这里的"x",可以为你查询到的一个值,当这个值为null时,不管你的number是多少,它的值都会变为null 解决这个问题我们可以用:ifnull(param,value)这个函数 它的意思是,当param这个值为null时,会给它设置默认值为value 所以这里的update语句我们可以写为…