persistence@glassfish.java.net

Setting persistence.xml properties programmatically

From: RMMM <morelli867_at_comcast.net>
Date: Mon, 28 Jul 2008 00:27:19 -0700 (PDT)

I'm writing an application that will connect to a database that depends on
the user. For
that reason, I can't have the connection information in persistence.xml (the
schema
is always the same though). I'm tentatively planning on using TopLink
Essentials for
the JPA implementation, assuming I can get answers my questions ...

The connection is determined by 4 properties in the persistence.xml file:
jdbc driver,
and the database url, user, and password.

Given the 4 strings (driver, url, user, password), what Java code do I write
that is
equivalent to having those in the persistence.xml file?

I'm a little puzzled why this isn't spelled out anywhere I've looked. Isn't
it one of the
most obvious, basic issues? I'd think it would be near the beginning of
almost any
discussion of JPA or TopLink Essentials ..., but it isn't. Is it documented
somewhere?
Is there a snippet of example code I can find? Would someone be kind enough
to just
give me the code?

Thanks.
-- 
View this message in context: http://www.nabble.com/Setting-persistence.xml-properties-programmatically-tp18685384p18685384.html
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.