-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: JPA with new persistence units created after deployment
PostPosted: Tue Sep 15, 2009 1:07 pm 
Newbie

Joined: Tue Sep 15, 2009 12:09 pm
Posts: 2
I am using JPA with Hibernate to create a Java SE desktop application. We have historically used an eight character identifier to uniquely identify a database area. Users can create new database areas which is assigned an identifier. I need to have a persistence unit created using this identifier. I don't know how to create a new persistence unit using this identifier after the application has been deployed. Any assistance that can be provided would be greatly appreciated. Dan


Top
 Profile  
 
 Post subject: Re: JPA with new persistence units created after deployment
PostPosted: Tue Sep 15, 2009 4:05 pm 
Newbie

Joined: Tue Sep 15, 2009 12:09 pm
Posts: 2
Well, as it turns out the answer to my question was much easier than I could have ever imagined. I was wondering why no one else seemed to have this problem. So, all I had to do was pass the 8 character studyId to the class that creates the EntityManagerFactory. I used the Persistence.createEntityManagerFactory(String persistenceUnit, Map<String, String> properties) to provide the "hibernate.connection.url" property a value of "jdbc:derby://localhost/database/EditorDatabase/"+studyId+";create=true";
Where the studyId represents the 8 character Id that the user selects when deciding which database to edit. It works like a charm.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.