persistence@glassfish.java.net

using jpa on existing databases

From: Alessandro Pedrotti <alessandrop_at_anthesi.it>
Date: Fri, 11 May 2007 08:27:50 +0200

The question is this:

I've never used jpa and persistence in my java ee 5 application.
Now i want to introduce it for some features.

My envirorment is glassfishThe question is this:

I've never used jpa and persistence in my java ee 5 application.
Now i want to introduce it for some features.

My envirorment is glassfish v1 appl server.

I want to write a simple ejb and the relative entity using jpa
technology, but i have the following problem.

My application uses severals connection pools, one pool per customer.
Currently the pool to be used is dinamically determined via jndi lookup
(at runtime).

When a new customer is added, he will have its own database.
So we create the database and the respective connection pool on the appl
server at runtime via the asadmin tool. No application ear re-packaging
and re-deploy is required.

Using jpa persistence unit i must statically define it in the
persistence.xml.

So running my application on domains that have different connection
pools, requires that my appication ear to be re-packaged, mapping in the
persistence.xml all the persistence units (that refer to the customer
database).

This is not good, because in this way i must package a
configuration-specific ear for every appl server (or domain).

Is this correct?

Is there an alternative to hot deploy the persistence units (with the
asadmin or smething like it), that will be looked up later via jndi lookup?

The statically source code definition is not usable in my envirorment.

Tahnks v1 appl server.

I want to write a simple ejb and the relative entity using jpa
technology, but i have the following problem.

My application uses severals connection pools, one pool per customer.
Currently the pool to be used is dinamically determined via jndi lookup
(at runtime).

When a new customer is added, he will have its own database.
So we create the database and the respective connection pool on the appl
server at runtime via the asadmin tool. No application ear re-packaging
and re-deploy is required.

Using jpa persistence unit i must statically define it in the
persistence.xml.

So running my application on domains that have different connection
pools, requires that my appication ear to be re-packaged, mapping in the
persistence.xml all the persistence units (that refer to the customer
database).

This is not good, because in this way i must package a
configuration-specific ear for every appl server (or domain).

Is this correct?

Is there an alternative to hot deploy the persistence units (with the
asadmin or smething like it), that will be looked up later via jndi lookup?

The statically source code definition is not usable in my envirorment.

Tahnks

-- 
__________________
Alessandro Pedrotti
Anthesi s.r.l.
via M.Misone, 14 - Riva del Garda (ITALY)
Tel. +39 0464 553300 Fax. +39 0464 559010
Http://www.anthesi.it - www.isiportal.com
-----------------------------------------------------------------------
Nota di riservatezza : Il presente messaggio, corredato dei relativi 
allegati, contiene informazioni da considerarsi strettamente 
riservate,ed è destinato esclusivamente al destinatario sopra indicato, 
il quale è l'unico autorizzato ad usarlo, copiarlo e, sotto la propria 
responsabilità, diffonderlo.Chiunque ricevesse questo messaggio per 
errore o comunque lo leggesse senza esserne legittimato è avvertito che 
trattenerlo, copiarlo, divulgarlo, distribuirlo a persone diverse dal 
destinatario è severamente proibito, ed è pregato di rinviarlo 
immediatamente al mittente distruggendone l'originale. Grazie.
Confidentiality Notice : This message, together with its annexes, 
contains information to be deemed strictly confidential and is destined 
only to the addressee(s) identified above who only may use, copy and, 
under his/their responsibility, further disseminate it. If anyone 
received this message by mistake or reads it without entitlement is 
forewarned that keeping, copying, disseminating or distributing this 
message to persons other than the addressee(s) is strictly forbidden and 
is asked to transmit it immediately to the sender and to erase the 
original message received. Thank you.