hi, thanks for all your help... as it turned out the problem was in my configuration :).. basically one of my service wasn't annotated with @Transaction tag and as a consequence my template was closing the session ..
On Mon, Jul 19, 2010 at 8:44 PM, Robert Taylor <[email protected]>wrote: > Hi Greg, > > I believe Brian is correct. > > You need to wrap BookDao.find(...) within a transaction or use > OpenSessionInView. > Either one of these should keep the session open when you are navigating > the object graph > in your DAO. If you use OSIV (OpenSessionInView) filter, then you can > navigate the > object graph in your web tier as well. > > We are using both OpenSessionInView filter and a service layer which acts > as a facade to the data layer (DAOs). The services are annotated with > @Transactional (although for readOnly transactions this is really > unnecessary within the OSIV scope; but they are there for consistency). > > /robert > ----- Original Message ----- From: "Brian Thompson" <[email protected] > > > To: "Struts Users Mailing List" <[email protected]>; < > [email protected]> > Sent: Monday, July 19, 2010 1:22 PM > Subject: Re: struts2+hibernate+spring - lazyInitaializationException > > > > Looks to me like the session is being closed in the scope of >> hibernateTemplate.get(). >> >> I don't see a transactionManager mentioned in the XML ... you could >> try adding something like this in the XML configuration file: >> >> <bean id="transactionManager" >> class="org.springframework.orm.hibernate.HibernateTransactionManager"> >> <property name="sessionFactory" ref="sessionFactory" /> >> </bean> >> >> <tx:annotation-driven transaction-manager="transactionManager" /> >> >> n.b. I haven't tested the above config, so it probably won't work >> as-is. Hopefully it helps, though. >> >> -Brian >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Greg Stasica

