Hi,

There's no portable way to specify a location other than
/META-INF/persistence.xml. However, you could dynamically create a jar
with your persistence.xml in the right location and then create a
ClassLoader with this jar in it.

Alternately, you could use the
OpenJPAPersistence.createEntityManagerFactory(String puName, String
rsrc) method.

-Patrick

On Jan 18, 2008 1:10 AM, zzzz8 <[EMAIL PROTECTED]> wrote:
>
> Is there any way I can specify the location of the persistence.xml file at
> runtime for my Java SE JPA app, before I create my entitymanagerfactory?
> There are times when I will not place the persistence.xml in
> META-INF/persistence.xml in my classpath... Or is this not possible? The
> really ugly way would be for me to write a method that reads in the
> properties of the specified persistence.xml config file at runtime - then
> assign it to the properties map when call the static method
> createentitymanagerfactory of the Persistence class - but that's really ugly
> and probably not portable. Does anyone have any ideas regarding this issue?
> TIA.
> --
> View this message in context: 
> http://www.nabble.com/Specifying-the-location-of-the-persistence.xml-file-at-runtime-tp14948023p14948023.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>



-- 
Patrick Linskey
202 669 5907

Reply via email to