Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

Tomcat Injection

ericp56

2008-07-08

Replies: Find Java Web Hosting

Author LoginPost Reply

Hello,

After reading some documentation, I though I had my injection code worked
out, but apparently not.

I am using Tomcat with OpenJPA.

In my class, I have:
 @PersistenceUnit(unitName = "CallScheduler")
 private @Resource(name="bean/OpenJPAEMF")OpenJPAEntityManagerFactory emf;
In my META-INF/context.xml, I have:
 <Resource name="bean/OpenJPAEMF" auth="Container"
 factory="org.apache.openjpa.persistence.OpenJPAEntityManagerFactory"
 type="org.apache.openjpa.persistence.OpenJPAEntityManagerFactory.class" />

While executing a method in my class, emf is still null.

How should I instantiate emf? I am under the impression that
OpenJPAPersistence.createEntityManagerFactory is for unmanaged code...

Eric
--
Sent from the OpenJPA Users mailing list archive at Nabble.com.

©2008 gg3721.com - Jax Systems, LLC, U.S.A.