Hi Tom,
So, there are some way to create multiple dinamics not concurrent data base
connection with glassfish?
--------------------------------------------------
From: "Tom Ware" <tom.ware_at_oracle.com>
Sent: Friday, July 04, 2008 5:07 PM
To: <persistence_at_glassfish.dev.java.net>
Subject: Re: two connections with a persistence unity
> There are definitely some limitations to the workarounds.
>
> You could define a number of persistence units in your persistence.xml
> that use the same classes and metadata.
>
> -Tom
>
> Daniel Benítez wrote:
>> Hi Tom,
>>
>> How I can create multiple versions of my persistence unit? with physical
>> files? I can't do that because I must connect with a lot of data base.
>>
>> Daniel Benítez.
>>
>>
>> --------------------------------------------------
>> From: "Tom Ware" <tom.ware_at_oracle.com>
>> Sent: Friday, July 04, 2008 3:28 PM
>> To: <persistence_at_glassfish.dev.java.net>
>> Subject: Re: two connections with a persistence unity
>>
>>> Hi Daniel,
>>>
>>> At the moment, TopLink Essentials does not support using connections
>>> that are defined differently within the same EntityManagerFactory. Here
>>> is the Issue Tracker issue that tracks this feature request:
>>>
>>> https://glassfish.dev.java.net/issues/show_bug.cgi?id=1575
>>>
>>> The workaround is to create multiple versions of your persistence unit
>>> and use different login information for each.
>>>
>>> -Tom
>>>
>>> Daniel Benítez wrote:
>>>> Hey everybody, We need help!!!
>>>>
>>>> For a connection with a Derby data base we are using a glassfish
>>>> persistence unit. For that, we have created that persistence unit
>>>> through
>>>> Netbeans and with:
>>>>
>>>> protected EntityManager em;
>>>> private static EntityManagerFactory emf;
>>>>
>>>> Properties databaseProperties = new Properties();
>>>>
>>>> databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_URL,
>>>> jdbcUrl);
>>>>
>>>> databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_DRIVER,
>>>> "org.apache.derby.jdbc.ClientDriver");
>>>>
>>>> databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_USER,
>>>> Usuario);
>>>>
>>>> databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_PASSWORD,
>>>> Contrasenya);
>>>>
>>>> emf = Persistence.createEntityManagerFactory(Manejador,
>>>> databaseProperties);
>>>> em = emf.createEntityManager( );
>>>>
>>>> as a code.
>>>>
>>>> The problem is that when we want to change the initial data base (using
>>>> for that, destroy funtion (
>>>>
>>>> public void destruir(){
>>>> em.clear();
>>>> em.close();
>>>> em = null;
>>>> emf.close();
>>>> //emf = null;
>>>> }
>>>>
>>>> ) eliminating the class and establishing a new
>>>> connection for this new data base ¡we always obtain a connection with
>>>> the
>>>> initial data base!!!
>>>>
>>>> What are we doing wrongly ?
>>>>
>>>> Is it possible to connect an unique persistence unit to different data
>>>> base? How?
>>>>
>>>> Thanks very much for the help
>>>
>