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're onto improving performance ). There's no reason I still can't Hibernate.initialize() or fetch join when I want to bring down the number of round-trips to the database. OSIV does provide a big boost ( to me, at least ) in being able to do rapid turn-around development. Toni Lyytikäinen wrote: > > 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 eager loading to fetch the properties. However, if you eager load too > many properties, the queries will become slow because of the joins. So > it's > all about finding a good balance that fits you database schema. In order > to > find the balance monitor the amount of queries your actions make, and the > time it took to execute the queries. In some simple database schemas OSIV > can be avoided but with complex schemas this isn't always the case. > > On 8/22/07, hezjing <[EMAIL PROTECTED]> wrote: >> >> 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 >> > 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 >> > fetching with Hibernate and use it for most cases and rely on OSIV only >> in >> > some special cases where eager fetching is not possible. This way it's >> often >> > possible to build entire web applications without resorting to use >> OSIV. >> > >> >> >> -- >> >> Hez >> > > -- View this message in context: http://www.nabble.com/Configuring-OpenSessionInViewInterceptor-as-S2%27s-interceptor-tf4310239.html#a12278172 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]