How to inject persistence context to different data source programmatically?

Now at runtime you can build entity-manager for the required persistence-unit. Create separate persistence-units for each data-source.

Configure required data-sources & persistent-units accordingly in persistence. Xml accordingly. PERSISTENCE_PROVIDER java:DATA_SOURCE_NAME -- other units Now at runtime you can build entity-manager for the required persistence-unit.

Create separate persistence-units for each data-source. //--- EntityManagerFactory emf = Persistence. CreateEntityManagerFactory(persistenceUnitName); EntityManager em = emf.

CreateEntityManager(); //--- Else you can also build factory by providing a map of properties like db-url, userName etc. CreateEntityManagerFactory(persistenceUnitName,propertiesMap); This will create and return an EntityManagerFactory for the named persistence unit using the given properties. Therefore you can change the properties at runtime accordingly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions