Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:26 Go to next message
Dmytro Pishchukhin is currently offline Dmytro PishchukhinFriend
Messages: 3
Registered: April 2010
Location: Germany
Junior Member

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.


Best regards,
Dmytro
Re: EL OSGi EntityManagerFactoryBuilder creates EntityManagerFactory for different DBs wrongly [message #1006044 is a reply to message #1005603] Tue, 29 January 2013 15:53 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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/


James : Wiki : Book : Blog : Twitter
Re: EL OSGi EntityManagerFactoryBuilder creates EntityManagerFactory for different DBs wrongly [message #1006095 is a reply to message #1006044] Tue, 29 January 2013 21:05 Go to previous message
Dmytro Pishchukhin is currently offline Dmytro PishchukhinFriend
Messages: 3
Registered: April 2010
Location: Germany
Junior Member

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?


Best regards,
Dmytro
Previous Topic:TABLE_PER_TENANT
Next Topic:@Index does not work
Goto Forum:
  


Current Time: Tue Mar 19 09:13:07 GMT 2024

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

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

Back to the top