Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » EL OSGi EntityManagerFactoryBuilder creates EntityManagerFactory for different DBs wrongly
EL OSGi EntityManagerFactoryBuilder creates EntityManagerFactory for different DBs wrongly [message #1005603] Sun, 27 January 2013 05:26 Go to next message
Eclipse UserFriend
Hello,

I'm trying to use EntityManagerFactoryBuilder to create 2 EntityManagerFactory instances for the same persistence unit but for different DBs.

emf1 = emfb.createEntityManagerFactory(config1);
emf2 = emfb.createEntityManagerFactory(config2);


difference between config1 and config2 - only DB connection settings (url, user, pass)

EntityManagerFactoryBuilder creates 2 EntityManagerFactory but it uses only config1 for it. config2 is ignored.

Is it a EL bug?

I've tested with 2.4.0 and 2.4.1 EL versions.
Re: EL OSGi EntityManagerFactoryBuilder creates EntityManagerFactory for different DBs wrongly [message #1006044 is a reply to message #1005603] Tue, 29 January 2013 10:53 Go to previous messageGo to next message
Eclipse UserFriend
In JPA you should use Persistence.createEntityManagerFactory(String name, Map properties) to create a persistence unit with different properties.

I'm not that familiar with EntityManagerFactoryBuilder, it is for OSGi, but for OSGi JPA support you should be using Eclipse Gemini.

See,
http://eclipse.org/gemini/
Re: EL OSGi EntityManagerFactoryBuilder creates EntityManagerFactory for different DBs wrongly [message #1006095 is a reply to message #1006044] Tue, 29 January 2013 16:05 Go to previous message
Eclipse UserFriend
I've tried to use Gemini JPA and got an exception:

org.eclipse.persistence.exceptions.PersistenceUnitLoadingException:
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: org.eclipse.ge
mini.jpa.classloader.CompositeClassLoader@b9e55c
Internal Exception: java.lang.NullPointerException
        at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(
PersistenceUnitLoadingException.java:127) ~[na:na]
        at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:118) ~[na
:na]
        at org.eclipse.gemini.jpa.ProviderWrapper.createEntityManagerFactory(ProviderWrapper.java:127) ~[na:na]
        at org.eclipse.gemini.jpa.proxy.EMFServiceProxyHandler.createEMF(EMFServiceProxyHandler.java:145) ~[na:na]
        at org.eclipse.gemini.jpa.proxy.EMFBuilderServiceProxyHandler.createEMF(EMFBuilderServiceProxyHandler.java:128)
~[na:na]


Does Gemini work under Felix?
Previous Topic:TABLE_PER_TENANT
Next Topic:@Index does not work
Goto Forum:
  


Current Time: Wed Jul 02 17:24:23 EDT 2025

Powered by FUDForum. Page generated in 0.04231 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top