Hi Harald, Strictly answering your question - No, the Aries code is not an implementation of the JPA service, and does not provide the EntityManagerFactoryBuilder service.
To predict your next problem - The EntityManagerFactoryBuilder will not solve the problem you have! The EntityManagerFactory builder allows you to delay specifying database metadata until runtime, but it can only be specified once. Once database configuration has been supplied the persistence unit is created and you have your one and only EntityManagerFactory. Any further calls to the builder with different configuration properties will result in an Exception (see the rebinding section of the JPA service specification). The "correct" solution for this is to define a persistence unit for each database that you need to use. If these persistence units make use of the same entity classes (possibly with different mappings) then all the persistence units that use the same entities should be in the same persistence bundle to ensure a consistent class-space. If the databases don't use the same tables then each persistence unit can be packaged separately in its own persistence bundle if you prefer. Fundamentally, once a persistence unit has been created its underlying datasource cannot be changed. After all, what would happen to other clients of the persistence unit who changed database half way through their operation? Regards, Tim ---------------------------------------- > From: [email protected] > To: [email protected] > Date: Mon, 27 Sep 2010 10:19:53 +0200 > Subject: JPA Service: EntityManagerFactoryBuilder > > The OSGi JPA Service defines an EntityManagerFactoryBuilder to be registered > for each discovered persistence unit. Is that supported by Aries at all? > > If not, are there alternative methods to create multiple > EntityManagerFactories for a given persistence unit, each with a different > data source? > > I'm thinking of a scenario where the application has to select the > appropriate database depending on the current client request. > > Best regards, > Harald >
