Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-04 Thread Dave Newton
--- Caine Lai [EMAIL PROTECTED] wrote: 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? What would built-in support for JPA and EJB3 look like? Seems to me that Hibernate is the current ad-hoc standard,

Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-04 Thread Al Sutton
I'd also add that Struts2 can be taken seriously because a large number of webapps are deployed to servlet engines that don't support EJBs such as Tomcat and Jetty and don't get deployed to full J2EE containers. Therefore requiring EJB support would most likley make Struts2 less likely to be

Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-04 Thread Jeromy Evans
To investigate this further I created an S2 webapp deployed within a JBoss 4.2.0 container using EJB3 stateless session beans and JPA entity beans. First of all though, if you use JPA in standalone mode you can use the open session in view pattern as discussed in prior emails. This question

Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-04 Thread Caine Lai
Thanks Jeromy, This was exactly what I was looking for. Very helpful. I was able to create a transaction in the web tier using a JNDI lookup of the UserTransaction. The transaction spans the entire request as needed. It still troubles me that any problems with the transaction commit will not

Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-02 Thread Caine Lai
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

Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-02 Thread Jeromy Evans
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

Re: How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-02 Thread Caine Lai
Hi Jeromy, Thanks for your response. It sounds like your solution works, but it doesn't seem like this would integrate with container managed persistence very well. It's strange this is so difficult to achieve in the next generation struts. I don't know why JPA/EJB3 is an afterthought. I

How does one use lazy loading in Struts 2 with container managed persistence?

2007-06-01 Thread Caine Lai
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