flex使用blazeds和java交互类型问题
下面是异常内容,环境是blazeds+spring+blazeds,User.feedBack是个Set<Feedback>,Feedback也是个model,是一对多关...
下面是异常内容,环境是blazeds+spring+blazeds,User.feedBack是个Set<Feedback>,Feedback也是个model,是一对多关联类型的属性,回答追加100分到300分,~
[BlazeDS]Exception occurred during serialization: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: net.jsdn.ecommerce.core.model.User.feedBack, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentBag.toArray(PersistentBag.java:280)
at java.util.ArrayList.<init>(ArrayList.java:131)
at flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44)
at flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:469)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:189)
at flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:257)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:602)
at flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:532)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:207)
at flex.messaging.messages.AbstractMessage.writeExternalBody(AbstractMessage.java:705)
at flex.messaging.messages.AbstractMessage.writeExternal(AbstractMessage.java:435)
at flex.messaging.messages.AsyncMessage.writeExternal(AsyncMessage.java:140)
at flex.messaging.messages.AcknowledgeMessage.writeExternal(AcknowledgeMessage.java:94)
at flex.messaging.messages.AcknowledgeMessageExt.writeExternal(AcknowledgeMessageExt.java:55)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:594)
at flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:532)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:112)
at flex.messaging.io.amf.Amf0Output.writeObject(Amf0Output.java:206)
at flex.messaging.io.amf.AmfMessageSerializer.writeObject(AmfMessageSerializer.java:196)
at flex.messaging.io.amf.AmfMessageSerializer.writeBody(AmfMessageSerializer.java:186)
blazeds+spring+Hibernate,上面说错了呵呵
at flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44)
at flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:469)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:189)
at flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:257)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:602)
at flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:532)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:207)
我知道是session问题,我也设置了spring的openSessionInViewFilter,在web.xml中,但是似乎没有效果,之前用struts的mvc的时候没有这个错误,现在改用flex去掉了struts就出现了这个错误,当我提取HttpSession中的User的时候提示User中的Set容器属性未初始化,不知道怎么解决,希望高手指点一二 展开
[BlazeDS]Exception occurred during serialization: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: net.jsdn.ecommerce.core.model.User.feedBack, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentBag.toArray(PersistentBag.java:280)
at java.util.ArrayList.<init>(ArrayList.java:131)
at flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44)
at flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:469)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:189)
at flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:257)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:602)
at flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:532)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:207)
at flex.messaging.messages.AbstractMessage.writeExternalBody(AbstractMessage.java:705)
at flex.messaging.messages.AbstractMessage.writeExternal(AbstractMessage.java:435)
at flex.messaging.messages.AsyncMessage.writeExternal(AsyncMessage.java:140)
at flex.messaging.messages.AcknowledgeMessage.writeExternal(AcknowledgeMessage.java:94)
at flex.messaging.messages.AcknowledgeMessageExt.writeExternal(AcknowledgeMessageExt.java:55)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:594)
at flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:532)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:112)
at flex.messaging.io.amf.Amf0Output.writeObject(Amf0Output.java:206)
at flex.messaging.io.amf.AmfMessageSerializer.writeObject(AmfMessageSerializer.java:196)
at flex.messaging.io.amf.AmfMessageSerializer.writeBody(AmfMessageSerializer.java:186)
blazeds+spring+Hibernate,上面说错了呵呵
at flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44)
at flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:469)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:189)
at flex.messaging.io.amf.Amf3Output.writeObjectProperty(Amf3Output.java:257)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:602)
at flex.messaging.io.amf.Amf3Output.writeCustomObject(Amf3Output.java:532)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:207)
我知道是session问题,我也设置了spring的openSessionInViewFilter,在web.xml中,但是似乎没有效果,之前用struts的mvc的时候没有这个错误,现在改用flex去掉了struts就出现了这个错误,当我提取HttpSession中的User的时候提示User中的Set容器属性未初始化,不知道怎么解决,希望高手指点一二 展开
4个回答
展开全部
又一个用hibernate悲剧的人。。。。延迟加载出现错误。。。我想是不是用外连接查询的时候调用外连接连接表的数据时报的错。。。我估计你是用hibernatesupportdao的save,find方法来提取数据,这样写肯定要报错。。。
用hql来写,首先在所有pojo的配置文件设置lazy=“false”。 然后用hql写
比如User表有个外键连接Employee ,String hql="select new cn..(包名).User() from User u right join empolyee"。记住“new cn..(包名).User() ”是创建了一个实例,所以括号内必须和User的构造方法一致
用hql来写,首先在所有pojo的配置文件设置lazy=“false”。 然后用hql写
比如User表有个外键连接Employee ,String hql="select new cn..(包名).User() from User u right join empolyee"。记住“new cn..(包名).User() ”是创建了一个实例,所以括号内必须和User的构造方法一致
大雅新科技有限公司
2024-11-19 广告
2024-11-19 广告
这方面更多更全面的信息其实可以找下大雅新。深圳市大雅新科技有限公司从事KVM延长器,DVI延长器,USB延长器,键盘鼠标延长器,双绞线视频传输器,VGA视频双绞线传输器,VGA延长器,VGA视频延长器,DVI KVM 切换器等,优质供应商,...
点击进入详情页
本回答由大雅新科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询