I had no idea it was not thread safe, in that case it is probably a
good idea to get factory and create an entity manager every time.

musachy

On Wed, Mar 18, 2009 at 1:30 PM, Burton Rhodes <[email protected]> wrote:
> I set up the example for "Struts 2 + Spring 2 + JPA + AJAX" using the
> OpenEntityManagerInViewFilter from the Struts website and all works
> well. (http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html).
>  It appears this example uses the @PersistenceContext annotation to
> inject the EntityManger into each Service/Dao class...
>
> Then I read this blog about how you SHOULD NOT use @PersistenceContext
> annotation in a webapp becasue of thread safety unless you implement a
> SingleThreadModel.
>
> http://weblogs.java.net/blog/ss141213/archive/2005/12/dont_use_persis_1.html
>
> Now I am confused...  Should I instead use @PersistenceUnit to inject
> the EntityManagerFactor into each Dao object?  And if so, won't this
> affect the OpenEntityManagerInViewFilter and cause Lazy exceptions?
> Can someone shead some light on this for me or am I not understanding
> this correctly?
>
> Apologies in advance if this is a bit off Struts topic...
>
> Thanks,
> Burton
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to