Gemini JPA principle questions [message #1739100] |
Wed, 27 July 2016 14:11  |
Pavel No Messages: 47 Registered: May 2016 |
Member |
|
|
Hello everyone.
I have two questions about jemini jpa:
1) How does it work? I mean just a line of sequences. For example, I see it this way:
mybunlde->jemini osgi service->eclipselink osgi service->h2 osgi service. Is this correct? If not then how?
2) If I have one persistence.xml in all my bundls then there is no question. I do this way:
reference = bundleContext.getServiceReference(EntityManagerFactory.class.getName());
EntityManagerFactory emf = (EntityManagerFactory) bundleContext.getService(reference);
EntityManager entityManager=emf.createEntityManager();
By other words I get factory and using that factory I get manager.
However, if I have N persistenceunits then what? As I understand I should get EntityManagerFactoryBuilder as osgi service and using it create factory? Something like
ServiceReference reference = bundleContext.getServiceReference(EntityManagerFactoryBuilder.class.getName());
EntityManagerFactoryBuilder emfb = (EntityManagerFactoryBuilder) bundleContext.getService(reference);
EntityManagerFactory emf=emfb.createEntityManagerFactory(map).
However, I can't understand how to add my entity classes to this map? Or should I link it with persistence.xml?
Please, help.
[Updated on: Wed, 27 July 2016 14:13] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02344 seconds