Hi Kalle,

On Wed, Mar 14, 2012 at 6:49 PM, Kalle Korhonen
<[email protected]>wrote:

> Hey Igor,
>
> I was just looking into the implementation of the core JPA
> integration. I had two questions about EntityManagerObjectProvider:
> - what's the purpose of making a proxy for the EntityManager (rather
> than just holding a reference to the EntityManager provided by the
> EntityManagerManager)?
>

EntityManager is a per-thread resource which is managed by
EntityManagerManager.
You need a proxy if you want the injected object to be recreated for each
request.


> - does it not make sense to check if the proxy exists first and return
> it right away before invoking the synchronized getOrCreateProxy?
>

You want to move the null check from getOrCreateProxy to provide or do you
want to double check?


>
> My motivation for the questions is that I want to advise
> EntityManager. Overriding EntityManagerObjectProvider seems like the
> best place to do it.
>

Feels like pain in the ass.


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


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de
http://twitter.com/drobiazko

Reply via email to