File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
How to create new persistence unit at run time?
Joined: Jan 10, 2007
Jun 04, 2007 12:13:00
I am working in
I have persistence.xml and in the file i create persistence
that is mapped to a data source and a schema.
I want to create in run time a new persistence unit and factory , that is mapped to another data source and schema.
I need it because i want to create copy of this unit in different schema for each user that register to the system.
My questions are:
How can i create new persistence unit at run time?
How can i save the new persistence unit that i created to the persistence.xml or to another file in order have them in case the server is crashed?
Can i create a data source that map to a data base url and not mapped to schema and in the persistence unit properties give the schema connection url ?
Thank you very much
Joined: Feb 05, 2001
Jun 06, 2007 21:12:00
Well, the way things are right now, I don't think you will be able to do this programatically and save it in a persistence.xml.
Perfect World Programming, LLC
Two Laptop Bag
How to Ask Questions the Smart Way FAQ
subject: How to create new persistence unit at run time?
Can I create data source at run time
EJB3 in action - Chapter 2 EAR file error
How to Configuring mysql db with JPA aplication?
EJB in action - Chapter 2 EAR file error
JPA PU and Entity Class problems
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013