Hello,
Hello!
I'm new to Hibernate, the thing is that, right now I have one database, but I'm being asked to extract a group of tables from that database, and create a new one so, I need to know a way to access to two databases using Hibernate, The way I'm asking for the sessionFactory is as follows:
Code:
public class HibernateUtil {
private static final SessionFactory sessionFactory;
static {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
// config file.
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
**** This is the template class which Netbeans creates.
I have a XML configuration file (hibernate.cfg.xml) and the mappings as XMLs too, so, what do I have to do in order to be able to access both databases? What do I have to change? If you have useful examples/articles to perform this, it will be very useful,
Thanks!!!
Alberto Cole