tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Embedding Openejb
Date Thu, 02 Apr 2009 18:50:09 GMT
On Apr 2, 2009, at 11:08 AM, Berry25 wrote:

>
> I am sorry, i absolutelly forgot about it.
> I´d like to ask somebody. I use for to get EntityManagerFactory and
> EntityManager this piece of code
> ..
>  context =
> SystemInstance
> .get().getComponent(ContainerSystem.class).getJNDIContext();
> ...
> 		
> 				    factory = (EntityManagerFactory)
> context.lookup("/openejb/PersistenceUnit/EJBProject 2026069911");
> 				
> EntityManager em= factory.createEntityManager();
>
>
> Is there any better way how to get an EntityManager or an
> EntityManagerFactory   ?

I'd recommend this technique over the direct lookup as the above code  
is guaranteed to break at some point.

   http://www.nabble.com/Re%3A-Obtaining-an-EntityManager-instance-outside-an-EJB-p21701466.html


-David


>
> thanks for your suggest
>
>
>
>
> Newgro wrote:
>>
>> Your problem is
>>
>> Connection refused: connect
>>
>> MySQL running? User Password correct? Do you use a firewall?
>>
>> Cheers
>> Per
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Embedding-Openejb-tp22802864p22853879.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Mime
View raw message