users@glassfish.java.net

Re: JPA toplink: Impossible to override User/Pass in new EntityManager

From: <glassfish_at_javadesktop.org>
Date: Sun, 20 Apr 2008 02:49:36 PDT

..How about... for example:

Properties properties = new Properties();
        properties.put(TopLinkProperties.JDBC_URL, dataBaseName);
        
        EntityManagerFactory BackUpEntityManagerFactory = javax.persistence.Persistence.createEntityManagerFactory("BackUp2008", properties);
        EntityManager BackupEntityManager1 = (EntityManager) BackUpEntityManagerFactory.createEntityManager(properties);
        
         try {
....
 catch(Exception ex) {
                  System.out.println("------> Error: " + ex.getMessage());
                  // BackupEntityManager.getTransaction().rollback();
         } finally {
                  BackupEntityManager1.close();
                  BackUpEntityManagerFactory.close();
        }


seems to work without any problems!
[Message sent by forum member 'wei2008' (wei2008)]

http://forums.java.net/jive/thread.jspa?messageID=270245