persistence@glassfish.java.net

Re: can I create an EntityManagerFactory in Java EE?

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 16 Feb 2009 10:18:54 -0400

You can call Persistence.createEntityManagerFactory(String, Map) in Java
EE as well.
--Gordon

Decker, Paula (EOIR) wrote:
>
> Hello,
>
>
>
> Is it possible to change the database in Java EE based on values read
> in from a config file? How can I create an EntityMangerFactory based
> on the new database parameters?
>
>
>
> I know this can be done in Java SE, by creating an
> EntityManagerFactory with a map containing user, password, database
> url, and driver.
>
>
>
> What about Java EE? I know the container is responsible for creating
> the EntityManagerFactory based on the persistence.xml file it finds
> packaged in the war file. Is it advisable to create a new
> EntityManagerFactory in Java EE? Is it possible?
>
>
>
> Thanks in advance.
>
>
>
> PD
>
>
>
>
>