Hi Caine,

I use JPA. I place the EntityManagerFactory into the application context so it can be accessed by an S2 interceptor. The S2 interceptor creates an EntityManager for each request as per the open session in view pattern and so lazy loading can be used where appropriate. This doesn't qualify as CPM though which is what you asked for. I haven't tried using S2 with an EJB container yet.

There's no need to use spring.

cheers,
Jeromy Evans

Caine Lai wrote:
No one? This seems like a major design flaw in Struts 2, if there is no way
to use lazy loading in Struts 2 using JPA.

I've read something online that describes it may be possible to write a
custom interceptor that can scan for annotations and inject the persistence context into a struts action. But without framework support for JPA (built
in), how can Struts 2 ever be taken seriously?  Isn't EJB3 and JPA the
current standard spec?

I'm not at all interested in using Spring either.  And quite fankly I
shouldn't be forced to use Spring purely for the Open Session in View
pattern.

Thoughts?

On 6/1/07, Caine Lai <[EMAIL PROTECTED]> wrote:

I'm using EJB3 stateless session beans/JPA/JTA to manage my data access.
But I can't figure out how one would use lazy loading in this scenario since any transaction opened in the EJB layer will already be committed prior to
rendering the view.

Any tips?

I'm familiar with "Open Session in View" when using hibernate, but it's
not quite the same when I'm using container managed transactions and
dependency injection in EJB3.  Or is it?  Would I still open a hibernate
session within the view and close it after the view is rendered in this
scenario?

Thanks for any pointers.


------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 269.8.7 - Release Date: 2/06/2007 12:00 AM


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to