Because when the object is serialized, we get a LazyException (session
closed)
Thanks
--
View this message in context: http://www.nabble.com/How-can-we-get-an-hibernate-session-interceptor-configured-in-Mule--tp14600208p14600208.html
Sent from the Mule - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
Here is the stack trace:
2008-01-04 16:30:56,427 INFO [STDOUT] 16:30:56,421 ERROR
[LazyInitializationException] Failed to lazily initialize a collection - no
session or session was closed
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a
collection - no session or session was closed
at
net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)
at
net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.size(Set.java:106)
at
org.apache.axis.encoding.ser.ArraySerializer.serialize(ArraySerializer.java:221)
at
org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1504)
at
org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:980)
at
org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1055)
at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
at
org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
at
org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)
at org.apache.axis.Message.getContentType(Message.java:486)
at
org.mule.providers.soap.axis.AxisServiceComponent.doPost(AxisServiceComponent.java:612)
at
org.mule.providers.soap.axis.AxisServiceComponent.onCall(AxisServiceComponent.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.mule.impl.model.resolvers.DynamicEntryPoint.invokeMethod(DynamicEntryPoint.java:312)
at
org.mule.impl.model.resolvers.DynamicEntryPoint.invoke(DynamicEntryPoint.java:259)
at
org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:194)
at
org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47)
at
org.mule.interceptors.EnvelopeInterceptor.intercept(EnvelopeInterceptor.java:44)
at
org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47)
at
org.mule.impl.model.DefaultMuleProxy.onCall(DefaultMuleProxy.java:258)
at
org.mule.impl.model.seda.SedaComponent.doSend(SedaComponent.java:393)
at
org.mule.impl.model.AbstractComponent.sendEvent(AbstractComponent.java:418)
at org.mule.impl.MuleSession.sendEvent(MuleSession.java:349)
at
org.mule.routing.inbound.InboundRouterCollection.send(InboundRouterCollection.java:197)
at
org.mule.routing.inbound.InboundRouterCollection.route(InboundRouterCollection.java:163)
at
org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:581)
at
org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:322)
at
org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:269)
at
org.mule.providers.http.HttpMessageReceiver$HttpWorker.doGetOrPost(HttpMessageReceiver.java:233)
at
org.mule.providers.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:177)
at
org.mule.providers.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:150)
at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987)
at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528)
at java.lang.Thread.run(Thread.java:595)
--
View this message in context: http://www.nabble.com/How-can-we-get-an-hibernate-session-interceptor-configured-in-Mule--tp14600208p14618944.html
We want to put this library into mule by exposing the methods of dao as
webservices (and then the client would invoke webservices). But when we
invoke these methods we have a lazy exceptions (because some collections are
lazy loaded). Perhaps this is not the right approach? what should we do?
thanks for your answers.
--
View this message in context: http://www.nabble.com/How-can-we-get-an-hibernate-session-interceptor-configured-in-Mule--tp14600208p14627547.html
Thanks a lot for your answers.
--
View this message in context: http://www.nabble.com/How-can-we-get-an-hibernate-session-interceptor-configured-in-Mule--tp14600208p14631579.html
transformer) When this tranformation occurs your Session is already
closed.
I also thought about implementing an Hibernate Session Interceptor but
this
will not work correctly because of the mule message flow: See the image
under "The Programming Model" in
http://mule.mulesource.org/display/MULE/Programmers+Guide
Because an "Outbound Transformer" comes after the "Envelope
interceptor",
which will close the session,you will still run into
LazyInitializationException exception when trying to access not
initialized
parts of the object graph.
The solution i used was to set the hibernate mappings for some
associated
objects to "lazy=false"
See
http://www.hibernate.org/hib_docs/v3/reference/en/html/performance.html#
performance-fetching-lazy
But be careful with "lazy=false" setting that you won't query to much.
Another solution would be to create an dto when the Session is still
active. Your using spring so it's worth to look at doing the hibernate
session/transaction management by using spring aop. With this you'll
have finer control over your Session lifetime
Regards Rob
> -----Oorspronkelijk bericht-----
> Van: Slyge [mailto:slyg...@yahoo.fr]
> Verzonden: zaterdag 5 januari 2008 11:06
> Aan: us...@mule.codehaus.org
> Onderwerp: Re: [mule-user] How can we get an hibernate
> session interceptor configured in Mule?
>
>