Hi everybody,
i want to deliver a objectgraph for my swing app wich is connected over spring http remoting.
as i dont want to give up the lazy loading performance gains i want to intialize the object graph before sending it to the client.
I have a Dao that is accessed by the remote server with the following method:
The first call getHibernateTemplate().get(Catalog.class,new Long(1)); works without any problems. But when it call getHibernateTemplate().initialize(rootCatalog.getC atalogs());Code:public Catalog getRootCatalog() { Catalog rootCatalog = (Catalog) getHibernateTemplate().get(Catalog.class,new Long(1)); getHibernateTemplate().initialize(rootCatalog.getCatalogs()); return rootCatalog; }
i get a lazy initialization exeception:
org.springframework.orm.hibernate3.HibernateSystem Exception: disconnected session; nested exception is org.hibernate.HibernateException: disconnected session
org.hibernate.HibernateException: disconnected session
I use declarative transactions:
<bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean" abstract="true">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="store*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="trans4" parent="baseTransactionProxy">
<property name="target" ref="catalogDAO" />
</bean>
I also tried to set:
<prop key="initialize*">PROPAGATION_REQUIRED,readOnly</prop>
Without any success.
I would be very happy if someone could help me.


Reply With Quote