You can't use the OpenSessionInViewInterceptor from Spring in Struts 2.
Struts 2 interceptors are not compatible with Spring interceptors as they
have their own interface. You'll have to use OpenSessionInViewFilter. Take a
look here:

http://www.springframework.org/docs/api/org/springframework/orm/hibernate/support/OpenSessionInViewFilter.html



On 8/22/07, hezjing <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I'm encountering this exception (when trying to iterate a list of
> orders for a specific customer in JSP),
>
> failed to lazily initialize a collection of role:
> com.dummy.Customer.orders, no session or session was closed
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException
> (AbstractPersistentCollection.java:358)
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected
> (AbstractPersistentCollection.java:350)
> at org.hibernate.collection.AbstractPersistentCollection.initialize(
> AbstractPersistentCollection.java:343)
> at org.hibernate.collection.AbstractPersistentCollection.read(
> AbstractPersistentCollection.java:86)
> at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:249)
> at org.apache.struts2.util.MakeIterator.convert(MakeIterator.java:81)
> ......
>
> I'm using Struts 2, Hibernate and Spring (for creating actions, DAOs and
> etc).
>
> I read that Spring's OpenSessionInViewInterceptor will resolve this
> problem but can you describe how to configure
> OpenSessionInViewInterceptor in Struts2?
>
> And, is there a better alternative than using
> OpenSessionInViewInterceptor?
>
>
>
> --
>
> Hez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to