PDA

View Full Version : LazyInitialization with EJBs



alesj
Sep 28th, 2004, 02:27 AM
Is it possible or not to use (Hibernate) lazy approach (OpenSessionInViewInterceptor) when accessing data with EJB Session object (local)?

From what I understood from 'Hibernate in Action' (and my understandment (not a great one :oops:) of EJB's) you cannot use this approach.

But what does then this thread say (http://forum.springframework.org/showthread.php?t=9622)?

Thanx for shining a little light on that, Ales 8)

Alef Arendsen
Sep 28th, 2004, 03:40 PM
To be honest, I've never tried it, but I wouldn't know why it wouldn't work, provided that you're using session bean through a local interface. Local session beans have pass by reference semantics as opposed to old-fashioned remote session beans, that have pass by value semantics according to the spec.

Anybody else?

Colin Sampaleanu
Sep 29th, 2004, 01:44 PM
It should work absolutely fine with local session beans, as Alef says. It may even work ok with remote beans in some containers, as they optimize the same-VM case...