net.sf.json.JSONException: Positioned Update not supported.
来源:互联网 发布:linux查看配置文件 编辑:程序博客网 时间:2024/04/30 11:04
Caused by: java.sql.SQLException: Positioned Update not supported.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.getCursorName(ResultSet.java:1917)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getCursorName(NewProxyResultSet.java:545)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.getCursorName(ResultSet.java:1917)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getCursorName(NewProxyResultSet.java:545)
... 152 more
package:net.sf.json.JSONObject
原因:在SSH框架中,所有经由Hibernate持久化管理的对象自带一个handler属性,如果你启用了Lazy加载,还会多出一个hibernateLazyInitializer的属性,
而实体类之中是没有这个属性的,所以就需要先利用jsonConfig把这些不必要的属性给过滤掉,再转为JSON。
由于这个属性的存在,由Hibernate查询出来的对象在转化为JSON的时候会报上面的异常
解决方法:用JSONConfig过滤一下,在转换为JSON对象的时候不对该属性进行转换,这个方法也可以用来对不想进行JSON转换的属性进行过滤。
<pre name="code" class="java">JsonConfig jsonConfig = new JsonConfig();jsonConfig.setExcludes(new String[]{"handerler","hibernateLazyInitializer"});String tmp = JSONObject.fromObject(object).toString();
jsonConfig.setExcludes <span style="font-family: Arial; background-color: rgb(255, 255, 255);">的作用是过滤不需要参与json序列化的类</span>
0 0
- net.sf.json.JSONException: Positioned Update not supported.
- Positioned Update not supported.
- Positioned Update not supported
- net.sf.json.JSONException
- Positioned Update not supported异常处理
- Struts2使用json-plugin出现java.sql.SQLException: Positioned Update not supported异常
- 解决Jsonwriter发生的Positioned Update not supported问题
- net.sf.json.JSONException: java.lang.NoSuchMethodException
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Unquotted string "E44C2B0168A550F6503F59CCD56FC49B"
- net.sf.json.JSONException: java.lang.NoSuchMethodException
- net.sf.json.JSONException: Object is null
- net.sf.json.JSONException: Object is null
- JSON中 net.sf.json.JSONException: java.lang.NoSuchMethodException异常
- net.sf.json.JSONException: There is a cycle in the
- net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
- net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
- 机房收费系统模块篇—Split函数、InStr函数
- GTK入门学习:glade的使用
- Gson的简单使用
- 微信红包接入1-接入前准备
- Asp.net生成Excel文件并下载(更新:解决使用迅雷下载页面而不是文件的问题)
- net.sf.json.JSONException: Positioned Update not supported.
- 《C++编程思想》第三章 隐藏实现 (原书代码+习题+解答)
- 深入理解Activity生命周期的回调
- TP中写操作数据的收集方法
- Android开发之动态创建布局文件及控件
- sql server 查看表的死锁和Kill 死锁进程
- 互联网协议入门深入
- Java安全通信:HTTPS与SSL
- test