[Solved]Recalibrate EMF or EM during runtime - database location [message #964686] |
Tue, 30 October 2012 18:14 |
Scott Hull Messages: 32 Registered: July 2012 |
Member |
|
|
This is a shot in the dark. I do not think this can be possible, but I wanted to see if anyone has figured out a way to make this work. This topic does coincide with dynamic PUs, but not with editing the managed types or the entities.
Hi, I wanted to figure out if there was a way to change the database location during runtime (create a new one if necessary). Here are the restrictions currently within my application:
1.) The persistence.xml file can not be edited during runtime.
2.) The factory is automatically given based on the xml requirements with a pre-determined database location.
3.) The factory is created within a PDE and Dynamic Service call.
4.) You can assume that the database has not been created in its new location. However, the preset database can be created.
5.) The factory can not be destroyed and re-created (yes, the hard part).
In other words, I am looking for a way to change value of the property(and only this property):
javax.persistence.jdbc.url
Here are some things I have tried:
1.) Create the EntityManager with a modified properties file from the static factory(new location of database). Although this does create the database, it does not establish the mapping.
My overall goal is to have the product allow the option to specify a database location during runtime. If I have to restart the application in order for this to be achieved successfully, that is acceptable.
I understand that the easiest way to solve this problem is to recreate the factory instance with a modified PU, but that is not an option at this time.
I am open to some pretty creative ideas at this point.
Thanks
[Updated on: Wed, 31 October 2012 12:11] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04615 seconds