首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

flex使用hibernate报错误了

2013-01-01 
flex使用hibernate报异常了[BlazeDS]Exception occurred during serialization: org.hibernate.LazyInitia

flex使用hibernate报异常了
[BlazeDS]Exception occurred during serialization: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.accp.pjo.User.roles, 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.PersistentSet.toArray(PersistentSet.java:194)
at java.util.ArrayList.<init>(Unknown Source)
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.io.amf.Amf3Output.writeObjectArray(Amf3Output.java:854)
at flex.messaging.io.amf.Amf3Output.writeAMFArray(Amf3Output.java:445)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:193)
at flex.messaging.io.ArrayCollection.writeExternal(ArrayCollection.java:97)
at flex.messaging.io.amf.Amf3Output.writePropertyProxy(Amf3Output.java:594)
at flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:476)
at flex.messaging.io.amf.Amf3Output.writeObject(Amf3Output.java:189)
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)
at flex.messaging.io.amf.AmfMessageSerializer.writeMessage(AmfMessageSerializer.java:142)
at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:198)
at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$a07ca8f6.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)


at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

[解决办法]
Hibernate不精通最好不要用,改用IBatis

没人精通Hibernate的团队使用Hibernate,绝对是一个瓶颈

热点排行