Hi,
Thanks for the interesting responses!

In the end, I solved it by placing the openjpa jars in a subfolder of the
plugin calling Persistence.createEntityManagerFactory. I then configured
the plugin to add the jars to its classpath (manifest->runtime->claaspath->
add).

Also, persistence.xml must go into the plugin's manifest directory, not
src/manifest as all the JPA tutorials show.

I agree,  returning null is not helpful. I would vote for an exception with
an explanation.

Thanks, chris

> Re: newbie: null Entity Manager Factory in Eclipse
>
> It sounds like your META-INF/persistence.xml file isn't found on your
> classpath when running your RCP application. I really wish that
> createEntityManagerFactory would do something other than return null if a
> persistence unit isn't found.
>
> I'd suggest taking a close look at the classpath for your RCP
application.
> Hopefully this helps!
>
> -Rick
>
> On Mon, Jul 20, 2009 at 8:50 AM, Christopher Giblin
<[email protected]>wrote:
>
> >
> > Hi,
> > When I run my test as a standalone Java program, things work.
> > When I launch the same code from within a plugin in an Eclipse RCP app,
> > Persistence.createEntityManagerFactory returns null.
> >
> > I have called Persistence.createEntityManagerFactory both ways, with
and
> > without persistence.xml. Get null both ways.
> >
> > I have googled and have done everything recommended in those posts,
> > including initializing the factory with properties and making sure the
jdbc
> > driver is on the class path. Still get null.
> >
> > I feel I am now going round in circles. Any hints?
> >
> > Thanks, chris
> >
> >
> >
> >
> >

Reply via email to