Hibernate serialisation failing
I have multiple sessionFactories, and I am using the spring-flex-core-1.5.0.M2.jar release, but when I try to return an object to the Flex client, I get the following error:
Code:
trackitude => [log level: DEBUG] [thread: http-8080-1] [logging time (ms): 154176]
org.springframework.flex.core.io.SpringPropertyProxy.getValue [line: 85]
Actual type of value for property 'dayEntryId' on instance uk.co.prodia.prosoc.domainmodel.HtDayEntry@40b35cf0 is class java.lang.Integer
trackitude => [log level: DEBUG] [thread: http-8080-1] [logging time (ms): 154176]
org.springframework.flex.core.io.SpringPropertyProxy.getValue [line: 85]
Actual type of value for property 'flexDayEntryId' on instance uk.co.prodia.prosoc.domainmodel.HtDayEntry@40b35cf0 is class java.lang.String
trackitude => [log level: DEBUG] [thread: http-8080-1] [logging time (ms): 154176]
org.springframework.flex.core.io.SpringPropertyProxy.getValue [line: 85]
Actual type of value for property 'flexDayLineId' on instance uk.co.prodia.prosoc.domainmodel.HtDayEntry@40b35cf0 is class java.lang.String
trackitude => [log level: DEBUG] [thread: http-8080-1] [logging time (ms): 154176]
org.springframework.flex.core.io.SpringPropertyProxy.getValue [line: 85]
Actual type of value for property 'htDay' on instance uk.co.prodia.prosoc.domainmodel.HtDayEntry@40b35cf0 is class uk.co.prodia.prosoc.domainmodel.HtDay
trackitude => [log level: DEBUG] [thread: http-8080-1] [logging time (ms): 154177]
org.springframework.flex.core.io.SpringPropertyProxy.getValue [line: 85]
Actual type of value for property 'htDayEntryNotes' on instance uk.co.prodia.prosoc.domainmodel.HtDayEntry@40b35cf0 is class org.hibernate.collection.PersistentSet
[BlazeDS]02/11/2011 13:14:36.114 [ERROR] Exception occurred during serialization: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: uk.co.prodia.prosoc.domainmodel.HtDayEntry.htDayEntryNotes, 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>(ArrayList.java:131)
at flex.messaging.io.ArrayCollection.<init>(ArrayCollection.java:44)
at flex.messaging.io.amf.Amf3Output.writeArrayCollection(Amf3Output.java:469)
It seems to be failing when trying to access the Hibernate proxy. I think Spring/Flex should be setting this value to a null here, but for some reason it isn't.
Here is my Spring config, I have tried it with and without the ConversionService being defined:
Code:
<flex:message-broker>
<flex:config-processor ref="hibernateConfigProcessor" />
</flex:message-broker>
<bean id="hibernateConfigProcessor" class="org.springframework.flex.core.io.HibernateConfigProcessor">
<property name="sessionFactory" ref="sessionFactoryProsoc"/>
<!--<property name="conversionService" ref="conversionService" />-->
</bean>
<bean id="conversionService" class="org.springframework.core.convert.support.GenericConversionService"/>
Hints appreciated.