-
1. Re: Dynamically add persistence units
waynebaylor Aug 16, 2007 9:30 AM (in response to calidoggg)when you say dynamically add, do you mean that the database drivers, etc. already exist on the end-user's system or are those dynamically added also?
-
2. Re: Dynamically add persistence units
calidoggg Aug 16, 2007 1:34 PM (in response to calidoggg)"waynebaylor" wrote:
when you say dynamically add, do you mean that the database drivers, etc. already exist on the end-user's system or are those dynamically added also?
Hi Wayne,
The database drivers are dynamically added also by the end-user. Thanks. -
3. Re: Dynamically add persistence units
waynebaylor Aug 16, 2007 2:08 PM (in response to calidoggg)I imagine you could auto-generate the xml datasource based on the provided info and deploy it. But you might have to restart JBoss so that it could load the JDBC driver jar(which you would noramally put in .../server/default/lib). There is an off chance you could hot deploy the driver jar in the deploy dir though, i'm not sure.
-
4. Re: Dynamically add persistence units
calidoggg Aug 16, 2007 2:12 PM (in response to calidoggg)"waynebaylor" wrote:
I imagine you could auto-generate the xml datasource based on the provided info and deploy it. But you might have to restart JBoss so that it could load the JDBC driver jar(which you would noramally put in .../server/default/lib). There is an off chance you could hot deploy the driver jar in the deploy dir though, i'm not sure.
But is there a way to auto-generate our persistence.xml file based on dynamic addition of datasources? I agree with you that there is probably a way to auto-generate the datasource on JBoss's side, but what about on the persistence unit side? Thanks. -
5. Re: Dynamically add persistence units
waynebaylor Aug 16, 2007 2:44 PM (in response to calidoggg)if you wanted to modify a persistence.xml which has already been deployed you would have to undeploy it, unpack the ear/jar, modify the file, re-jar it, and deploy it.
if, however, you just want to point the datasource name in the persistence.xml to another datasource you could try undeploying the ds which currently has that name a deploying the "new" ds which has the same name, but references a different DB. -
6. Re: Dynamically add persistence units
calidoggg Aug 16, 2007 3:01 PM (in response to calidoggg)Yeah I thought of doing the changing the DB inside of one datasource, but then inside of my application itself, the user has the ability to choose which DB they want to use from a current list of DBs, and so that doesn't work because we just changed the datasource to be pointing to the newly-created database.
-
7. Re: Dynamically add persistence units
waynebaylor Aug 16, 2007 3:14 PM (in response to calidoggg)do you only support a given selection of DBs? if so, you could try specifying multiple datasources in your persistence.xml.
-
8. Re: Dynamically add persistence units
calidoggg Aug 16, 2007 3:18 PM (in response to calidoggg)That's the thing. The selection of DBs can always change, based on the dynamic nature of the user creating a new one (which is in a separate application all together), so I would have to keep updating the persistence.xml with new units everytime I create a new datasource.