Hey everybody, We need help!!!
For a connection with a Derby data base we are using a glassfish
persistence unit. For that, we have created that persistence unit through
Netbeans and with:protected EntityManager em;
private static EntityManagerFactory emf;
Properties databaseProperties = new Properties(); databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_URL, jdbcUrl); databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_DRIVER, "org.apache.derby.jdbc.ClientDriver"); databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_USER, Usuario); databaseProperties.setProperty(oracle.toplink.essentials.config.TopLinkProperties.JDBC_PASSWORD, Contrasenya); emf = Persistence.createEntityManagerFactory(Manejador, databaseProperties); em = emf.createEntityManager( );as a code.
The problem is that when we want to change the initial data base (using
for that, destroy funtion ( public void destruir(){ em.clear(); em.close(); em = null; emf.close(); //emf = null; }) eliminating the class and establishing a new
connection for this new data base ¡we always obtain a connection with the
initial data base!!!
What are we doing wrongly ?
Is it possible to connect an unique persistence unit to different data
base? How?
Thanks very much for the help