Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] multiple EntityManagers in one process

I am trying to build a schema migration functionality that requires separate connections to different databases.

What is happening is that the first entitymanagerfactory is initialized, connected to its database. Then I create another entitymanagerfactory with a different set of connection properties, using

    public static String JPA_DRIVER_PROP = "eclipselink.jdbc.driver";
    public static String JPA_URL_PROP = "eclipselink.jdbc.url";
    public static String JPA_USER_PROP = "eclipselink.jdbc.user";
public static String JPA_PASSWORD_PROP = "eclipselink.jdbc.password";

property names. Despite creating a "new" EntityManagerFactory object with a different set of properties, it still connects to the original database, i.e., it has the same connection information internally as the original entitymanagerfactory. I notice that it shares the same DatabaseAccessor object.

I'm clearly not understanding how this is supposed to work. What is the correct way to go about maintaining connections to separate databases?

Thanks.

=============================================
David Parker
dap@xxxxxxxxxxxxxxxxxxxx






Back to the top