LazyInitializationException after aop configuration
Hello, I recently opened a thread here.
I did because I was getting this exception:
Quote:
4423 [main] ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: path.model.listObjects, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: path.model.listObjects, no session or session was closed
So I tried to set up aop (I think succesfully) in my project, to leave Spring the work to open/close the conections with the database. But after that I am getting the same exception. Could it be another reason for that??
The file where I have set up aop configuration is:
Quote:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceOperation"
expression="execution(* path.services.**.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
</aop:config>
<bean id="ontologyDao" class="path.services.OntologyDao">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
Now the explanation:
path.services is the package where the implementations are
path.services.localImpl is the package where the interfaces are
Thanks in advance