users@glassfish.java.net

Re: is it possible to use JPA without that persistence.xml file?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Tue, 04 Aug 2009 16:00:30 +0530

You have to use persistence.xml to use JPA. I am assuming you are
writing a standalone Java application and not an EE application. You can
specify the JDBC URL in the map while calling Persistence.createEMF. The
property name is same as what's used in persistence.xml.

Sahoo

Sarah kho wrote:
> Hi
> Thank you for reading my post.
> I am looking for a way to use JPA but I want to set the connection url
> during application startup and not in the development time.
> I should run the application on multiple machines and each machine has
> its own ip address which database is running on t.
> I should change the connection url and create tens of distribution for
> all of computers which want to use it. if there was a way to set the
> connection URL programmically all of my build and distribution
> problems will vanish.
> Thanks.