Back Forum Reply New

Failed to lazy load object with Hibernate when using AspectJ

Hi,
I am using AspectJ to dependency inject a domain object (domain.report.Report) and I'm using Hibernate for persistency.

When I run a test that loads my object it worked fine, but when I try to load it using lazy loading I notice that the CGLIBLazyInitializer in his getProxy() method failed to create a Proxy to my object, and eventually The following exception is thrown:
Code:
org..beans.factory.NoSuchBeanDefinitionException:
No bean named 'domain.report.Report$$EnhancerByCGLIB$$ea01d7bc' is defined.
Well... indeed no such bean (domain.report.Report$$EnhancerByCGLIB$$ea01d7bc) is defined in my spring's context files, my xmls populate bean for the real domain object which is domain.report.Report.

I'm using Spring 2.0, @Configurable and lt;aop:spring-configured/gt;

Thanks in advance.
Guy.

If you are declaring a bean with id of domain.report.Report as a prototype in your applicationContext, then use the following annotation in your report class:

@Configurable( quot;domain.report.Reportquot; )

If I understand your question correctly, this should cause it to find the correct prototype definition in your application context.

Hi Corby,
Thanks for your fast reply ,it solved my problem.

Guy
¥
Back Forum Reply New