Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread cilquirm
In my experience, just having OSIV doesn't automatically imply that you expect all your data to be retrieved ad-hoc. (maybe the users do :) OSIV doesn't prevent the user from using eager fetching when necessary or useful ( and my experience delays it until your application is working and you'r

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Toni Lyytikäinen
Lazy initialization is to boost performance. The problem is that it doesn't apply to all cases. In cases where you have to iterate over a list of objects and those have lazy loading properties that you need, it will generate a lot of extra queries to to database. In those cases it's best to use eag

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread hezjing
This is something new to me, I always thought that lazy initialization is to boost performance. So we should really use eager fetching by default and minimize the use of OSIV. On 8/22/07, Toni Lyytikäinen <[EMAIL PROTECTED]> wrote: > "And, is there a better alternative than using > OpenSessionInV

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Toni Lyytikäinen
"And, is there a better alternative than using OpenSessionInViewInterceptor?" Yes. It's important to realise that while OpenSessionInView feels very handy, it is not a particularly nice design pattern, as it can stress your database with lots of small queries. It's best to learn how to do eager fe

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Roberto Nunnari
probably you'll need to invert the filter-mapping declaration order. hezjing wrote: With OpenSessionInViewFilter, my web.xml will look like this struts2 org.apache.struts2.dispatcher.FilterDispatcher sessionFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread hezjing
With OpenSessionInViewFilter, my web.xml will look like this struts2 org.apache.struts2.dispatcher.FilterDispatcher sessionFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter struts2 /* sessionFilter /* Does it cause any conflict when both struts2

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Toni Lyytikäinen
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/

Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread hezjing
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.throwLazyInitializat