Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to work with multiple databases/schemas

In JPA the EntityManagerFactory is always cached.  So if you access the same
factory name twice, you will get the first instance back.  So you cannot
change your login parameters and get a different factory back.  The only way
to do this is to either create a separate persistence unit, or first close
all references to the first EntityManagerFactory, then create a new one
using the new login.

In EclipseLink it is also possible to change your login when creating an
EntityManager from the EntityManagerFactory, the login properties can be
passed to createEntityManager, see the EntityManagerProperties class in
org.eclipse.persistence.config for a list of properties.



Andreas König-2 wrote:
> 
> Hey there!
> 
> We are integrating some reporting functionalities and need to access the 
> ORA-DB as another user than in the rest of the app.
> How do I do this?
> We're working with spring and I already tried to configure a second 
> jpaTemplate with its own EntitymanagerFactory and own datasource. This 
> doesn't work. I always get the ORA-00942: table or view does not exist.
> Obviously the connection doesn't go to the right DB.
> Any help?
> 
> Greetz,
> kÖnig
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/How-to-work-with-multiple-databases-schemas-tp23367915p23490813.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top