You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurie Harper <la...@holoweb.net> on 2008/04/02 23:14:47 UTC

Re: [OT] Struts - Spring - hibernate and lazy initialization

This isn't really a Struts issue, since you're asking how to drive your 
service/dao layout from a thread outside the context of a Struts-served 
request. What you need to do in that case is to manage the Hibernate 
session from your worker thread. The thread needs to setup and open the 
Hibernate session before starting its work, and clean it up afterwards.

Since you're using Spring to wire your dependencies, you probably need 
to go through Spring to setup the Hibernate session for the worker 
thread. The Spring forums are probably the best place to seek advice 
with that.

L.

Yayo wrote:
> Sorry, more explanation is needed... I've got to launch a "batch process"
> it's not a batch but it's a long lasting process that could raise a timeout
> and tomcat will kill the worker thread... So I've launched a worker of my
> own to do the job and inform the user with a progress indicator or the like.
> 
> Also I may want to launch my workers using Quartz scheduling features but...
> A new thread doesn't have an Hibernate Session attached to it.
> 
> Now the circular reference. When I add proxies to my manager layer with an
> hibernateInterceptor wich needs a sessionFactory. Under the managers there
> are DAOs which depend on sessionFactory too and that's the cyclic reference.
> 
> Now the trace. Notice that this is just a cut from it but the "cause" is
> just the same stack trace
> 
> 
> Related cause:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'filterManager' defined in ServletContext resource
> [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> 'filterManagerTarget' while setting bean property 'target'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'filterManagerTarget' defined in ServletContext resource
> [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean 'filterDao'
> while setting bean property 'filterDao'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'filterDao' defined in ServletContext resource
> [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> 'sessionFactory' while setting bean property 'sessionFactory'; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sessionFactory' defined in ServletContext resource
> [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> 'dataSource' while setting bean property 'dataSource'; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'dataSource': FactoryBean which is currently in
> creation returned null from getObject
> Related cause: org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'filterManager' defined in ServletContext
> resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> 'filterManagerTarget' while setting bean property 'target'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'filterManagerTarget' defined in ServletContext resource
> [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean 'filterDao'
> while setting bean property 'filterDao'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'filterDao' defined in ServletContext resource
> [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> 'sessionFactory' while setting bean property 'sessionFactory'; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sessionFactory' defined in ServletContext resource
> [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> 'dataSource' while setting bean property 'dataSource'; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'dataSource': FactoryBean which is currently in
> creation returned null from getObject
> Related cause: org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'filterManager' defined in ServletContext
> resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> 'filterManagerTarget' while setting bean property 'target'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'filterManagerTarget' defined in ServletContext resource
> [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean 'filterDao'
> while setting bean property 'filterDao'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'filterDao' defined in ServletContext resource
> [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> 'sessionFactory' while setting bean property 'sessionFactory'; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sessionFactory' defined in ServletContext resource
> [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> 'dataSource' while setting bean property 'dataSource'; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'dataSource': FactoryBean which is currently in
> creation returned null from getObject
> Related cause: org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'filterManager' defined in ServletContext
> resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> 'filterManagerTarget' while setting bean property 'target'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'filterManagerTarget' defined in ServletContext resource
> [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean 'filterDao'
> while setting bean property 'filterDao'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'filterDao' defined in ServletContext resource
> [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> 'sessionFactory' while setting bean property 'sessionFactory'; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sessionFactory' defined in ServletContext resource
> [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> 'dataSource' while setting bean property 'dataSource'; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'dataSource': FactoryBean which is currently in
> creation returned null from getObject
> Related cause: org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'filterManager' defined in ServletContext
> resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> 'filterManagerTarget' while setting bean property 'target'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'filterManagerTarget' defined in ServletContext resource
> [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean 'filterDao'
> while setting bean property 'filterDao'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'filterDao' defined in ServletContext resource
> [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> 'sessionFactory' while setting bean property 'sessionFactory'; nested
> exception is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sessionFactory' defined in ServletContext resource
> [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> 'dataSource' while setting bean property 'dataSource'; nested exception is
> org.springframework.beans.factory.BeanCurrentlyInCreationException: Error
> creating bean with name 'dataSource': FactoryBean which is currently in
> creation returned null from getObject
>     at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
>     at
> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1210)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:978)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
>     at
> org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
>     at
> org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
>     at
> org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
>     at
> org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
>     at
> org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
>     at
> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
>     at
> org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
>     at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
>     at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
>     at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
>     at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>     at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
>     at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>     at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
>     at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>     at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>     at
> org.apache.catalina.core.StandardService.start(StandardService.java:516)
>     at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
>     at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
>     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:597)
>     at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> 
> 
> 
> On Wed, Apr 2, 2008 at 10:19 PM, Adam Hardy <
> ahardy.struts@cyberspaceroad.com> wrote:
> 
>> Yayo on 02/04/08 20:23, wrote:
>>
>>> I'm developing  a struts - spring based application.
>>>
>>> I've got actions-delegates-managers and daos and I use the open session
>>> in
>>> view filter from hibernate.
>>>
>>> In some cases I've got to return lazy results to the user so I've got to
>>> launch a new worker thread and taht new one doesn't have an hibernate
>>> session attached so I've added hibernateInterceptors to my managers.
>>>
>>
>> Hi Yayo,
>> that paragraph doesn't sound right. You say 'lazy results' and so I
>> understand you want your hibernate entities to lazy load - is that correct?
>>
>> If that is correct, I don't see the connection with what you say 'launches
>> a new worker thread'. Why do you do that? If you need lazy loading, you make
>> sure the Hibernate session is still running, which you have already because
>> you use the OpenSessionInViewFilter.
>>
>> What is the reason for launching a new thread? The idiomatic
>> spring/hibernate approach doesn't require that. You just pass your hibernate
>> entities around and as long as the session is running, it will be fine.
>>
>>
>> Regards
>> Adam
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Struts - Spring - hibernate and lazy initialization

Posted by Yayo <ed...@gmail.com>.
Oki, thanks, I've posted to Spring mailing list with my problem ^g^

On Wed, Apr 2, 2008 at 11:14 PM, Laurie Harper <la...@holoweb.net> wrote:

> This isn't really a Struts issue, since you're asking how to drive your
> service/dao layout from a thread outside the context of a Struts-served
> request. What you need to do in that case is to manage the Hibernate session
> from your worker thread. The thread needs to setup and open the Hibernate
> session before starting its work, and clean it up afterwards.
>
> Since you're using Spring to wire your dependencies, you probably need to
> go through Spring to setup the Hibernate session for the worker thread. The
> Spring forums are probably the best place to seek advice with that.
>
> L.
>
>
> Yayo wrote:
>
> > Sorry, more explanation is needed... I've got to launch a "batch
> > process"
> > it's not a batch but it's a long lasting process that could raise a
> > timeout
> > and tomcat will kill the worker thread... So I've launched a worker of
> > my
> > own to do the job and inform the user with a progress indicator or the
> > like.
> >
> > Also I may want to launch my workers using Quartz scheduling features
> > but...
> > A new thread doesn't have an Hibernate Session attached to it.
> >
> > Now the circular reference. When I add proxies to my manager layer with
> > an
> > hibernateInterceptor wich needs a sessionFactory. Under the managers
> > there
> > are DAOs which depend on sessionFactory too and that's the cyclic
> > reference.
> >
> > Now the trace. Notice that this is just a cut from it but the "cause" is
> > just the same stack trace
> >
> >
> > Related cause:
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'filterManager' defined in ServletContext resource
> > [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> > 'filterManagerTarget' while setting bean property 'target'; nested
> > exception
> > is org.springframework.beans.factory.BeanCreationException: Error
> > creating
> > bean with name 'filterManagerTarget' defined in ServletContext resource
> > [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> > 'filterDao'
> > while setting bean property 'filterDao'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'filterDao' defined in ServletContext resource
> > [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> > 'sessionFactory' while setting bean property 'sessionFactory'; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> > Error
> > creating bean with name 'sessionFactory' defined in ServletContext
> > resource
> > [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> > 'dataSource' while setting bean property 'dataSource'; nested exception
> > is
> > org.springframework.beans.factory.BeanCurrentlyInCreationException:
> > Error
> > creating bean with name 'dataSource': FactoryBean which is currently in
> > creation returned null from getObject
> > Related cause: org.springframework.beans.factory.BeanCreationException:
> > Error creating bean with name 'filterManager' defined in ServletContext
> > resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to
> > bean
> > 'filterManagerTarget' while setting bean property 'target'; nested
> > exception
> > is org.springframework.beans.factory.BeanCreationException: Error
> > creating
> > bean with name 'filterManagerTarget' defined in ServletContext resource
> > [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> > 'filterDao'
> > while setting bean property 'filterDao'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'filterDao' defined in ServletContext resource
> > [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> > 'sessionFactory' while setting bean property 'sessionFactory'; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> > Error
> > creating bean with name 'sessionFactory' defined in ServletContext
> > resource
> > [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> > 'dataSource' while setting bean property 'dataSource'; nested exception
> > is
> > org.springframework.beans.factory.BeanCurrentlyInCreationException:
> > Error
> > creating bean with name 'dataSource': FactoryBean which is currently in
> > creation returned null from getObject
> > Related cause: org.springframework.beans.factory.BeanCreationException:
> > Error creating bean with name 'filterManager' defined in ServletContext
> > resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to
> > bean
> > 'filterManagerTarget' while setting bean property 'target'; nested
> > exception
> > is org.springframework.beans.factory.BeanCreationException: Error
> > creating
> > bean with name 'filterManagerTarget' defined in ServletContext resource
> > [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> > 'filterDao'
> > while setting bean property 'filterDao'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'filterDao' defined in ServletContext resource
> > [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> > 'sessionFactory' while setting bean property 'sessionFactory'; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> > Error
> > creating bean with name 'sessionFactory' defined in ServletContext
> > resource
> > [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> > 'dataSource' while setting bean property 'dataSource'; nested exception
> > is
> > org.springframework.beans.factory.BeanCurrentlyInCreationException:
> > Error
> > creating bean with name 'dataSource': FactoryBean which is currently in
> > creation returned null from getObject
> > Related cause: org.springframework.beans.factory.BeanCreationException:
> > Error creating bean with name 'filterManager' defined in ServletContext
> > resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to
> > bean
> > 'filterManagerTarget' while setting bean property 'target'; nested
> > exception
> > is org.springframework.beans.factory.BeanCreationException: Error
> > creating
> > bean with name 'filterManagerTarget' defined in ServletContext resource
> > [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> > 'filterDao'
> > while setting bean property 'filterDao'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'filterDao' defined in ServletContext resource
> > [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> > 'sessionFactory' while setting bean property 'sessionFactory'; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> > Error
> > creating bean with name 'sessionFactory' defined in ServletContext
> > resource
> > [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> > 'dataSource' while setting bean property 'dataSource'; nested exception
> > is
> > org.springframework.beans.factory.BeanCurrentlyInCreationException:
> > Error
> > creating bean with name 'dataSource': FactoryBean which is currently in
> > creation returned null from getObject
> > Related cause: org.springframework.beans.factory.BeanCreationException:
> > Error creating bean with name 'filterManager' defined in ServletContext
> > resource [/WEB-INF/spring/managers.xml]: Cannot resolve reference to
> > bean
> > 'filterManagerTarget' while setting bean property 'target'; nested
> > exception
> > is org.springframework.beans.factory.BeanCreationException: Error
> > creating
> > bean with name 'filterManagerTarget' defined in ServletContext resource
> > [/WEB-INF/spring/managers.xml]: Cannot resolve reference to bean
> > 'filterDao'
> > while setting bean property 'filterDao'; nested exception is
> > org.springframework.beans.factory.BeanCreationException: Error creating
> > bean
> > with name 'filterDao' defined in ServletContext resource
> > [/WEB-INF/spring/daos.xml]: Cannot resolve reference to bean
> > 'sessionFactory' while setting bean property 'sessionFactory'; nested
> > exception is org.springframework.beans.factory.BeanCreationException:
> > Error
> > creating bean with name 'sessionFactory' defined in ServletContext
> > resource
> > [/WEB-INF/spring/hibernate.xml]: Cannot resolve reference to bean
> > 'dataSource' while setting bean property 'dataSource'; nested exception
> > is
> > org.springframework.beans.factory.BeanCurrentlyInCreationException:
> > Error
> > creating bean with name 'dataSource': FactoryBean which is currently in
> > creation returned null from getObject
> >    at
> >
> > org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
> >    at
> >
> > org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1210)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:978)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
> >    at
> >
> > org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
> >    at
> >
> > org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
> >    at
> >
> > org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
> >    at
> >
> > org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1187)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:617)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:456)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:224)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:202)
> >    at
> >
> > org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:143)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:653)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:611)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1039)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:950)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
> >    at java.security.AccessController.doPrivileged(Native Method)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:263)
> >    at
> >
> > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:170)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
> >    at
> >
> > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
> >    at
> >
> > org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
> >    at
> >
> > org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
> >    at
> >
> > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
> >    at
> >
> > org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:254)
> >    at
> >
> > org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:198)
> >    at
> >
> > org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> >    at
> >
> > org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
> >    at
> >
> > org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
> >    at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> >    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
> >    at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
> >    at
> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> >    at
> > org.apache.catalina.core.StandardService.start(StandardService.java:516)
> >    at
> > org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
> >    at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
> >    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:597)
> >    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> >    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
> >
> >
> >
> > On Wed, Apr 2, 2008 at 10:19 PM, Adam Hardy <
> > ahardy.struts@cyberspaceroad.com> wrote:
> >
> >  Yayo on 02/04/08 20:23, wrote:
> > >
> > >  I'm developing  a struts - spring based application.
> > > >
> > > > I've got actions-delegates-managers and daos and I use the open
> > > > session
> > > > in
> > > > view filter from hibernate.
> > > >
> > > > In some cases I've got to return lazy results to the user so I've
> > > > got to
> > > > launch a new worker thread and taht new one doesn't have an
> > > > hibernate
> > > > session attached so I've added hibernateInterceptors to my managers.
> > > >
> > > >
> > > Hi Yayo,
> > > that paragraph doesn't sound right. You say 'lazy results' and so I
> > > understand you want your hibernate entities to lazy load - is that
> > > correct?
> > >
> > > If that is correct, I don't see the connection with what you say
> > > 'launches
> > > a new worker thread'. Why do you do that? If you need lazy loading,
> > > you make
> > > sure the Hibernate session is still running, which you have already
> > > because
> > > you use the OpenSessionInViewFilter.
> > >
> > > What is the reason for launching a new thread? The idiomatic
> > > spring/hibernate approach doesn't require that. You just pass your
> > > hibernate
> > > entities around and as long as the session is running, it will be
> > > fine.
> > >
> > >
> > > Regards
> > > Adam
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> > >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Sit tibi terra levis"

http://yayocaturas.blogspot.com/