• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA PU and Entity Class problems

 
vitesse wei
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a Swing project used persistence unit connect to database,and I also have several Entity classes to persist with database tables,information was displayed in a Swing Jtable ,appliation works fine with current database and table.
problems is that I want change database connection property in the persistance.xml file when i started application,can I change the persistence.xml file in my main method or main class constuctor?
another problems is that I also want change the schema in Entity class's Table annotation,sames like I have to change the source code and then recompile the entity class,that sames not realistic,any advice about this?
the thing behind this is tha I want change database information every time application run based on the content presented in another xml file in current folder.
any advices would be preciated!
 
vitesse wei
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For database connection,I just create serverl PUs in persistence.xml file,then when create EntityManager,I will use specific PU,the changes for persisence file solved

Another one is still there,How can we change the property of Schema in annotation @Table from Entity class? or can we leave it empty,then put schema in some where in PU?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic