tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Fetching a Persistence Context
Date Thu, 15 Oct 2009 22:46:24 GMT

On Oct 15, 2009, at 8:33 AM, Jean-Louis MONTEIRO wrote:

> Hi Quintin,
> you can use JNDI to get a reference.
> Have a look here

Wish I could delete that thread from the archive -- I should never  
have given out those internal details.  It's not portable and it is  
not even guaranteed to work in OpenEJB in the future.  That whole  
hashcode thing is a really ugly workaround and I'd really like to find  
another way to do that chunk of code.

The @PersistenceContext can be used to make things available in JNDI  
for lookup and is what should be used -- that or a <persistence- 
context-ref> entry in xml.

I'm not sure why this page is formatted so strangely, but it has the  
right info:

This is the wiki version which looks better:


> Q Beukes wrote:
>> Hey,
>> When I have an EntityManager injected while having multiple
>> persistence units, I do it by specifying the unit name, something
>> like:
>> @PersistenceContext(unitName="Some-PU")
>> private EntityManager em;
>> Is it possible to do this not by injection, but fetching it by name
>> through an API of some sort?
>> Quintin Beukes
> -- 
> View this message in context:
> Sent from the OpenEJB User mailing list archive at

View raw message