Code:
Configuration cfg1 = new Configuration()
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect")
.setProperty("hibernate.connection.datasource", "java:comp/env/jdbc/test1")
.setProperty("hibernate.order_updates", "true")
.addResource("map1_1.hbm.xml")
.addResource("map1_2.hbm.xml");
SessionFactory sessions1 = cfg1.buildSessionFactory();
Session session1 = sessions1.openSession();
Configuration cfg2 = new Configuration()
.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLInnoDBDialect")
.setProperty("hibernate.connection.datasource", "java:comp/env/jdbc/test2")
.setProperty("hibernate.order_updates", "true")
.addResource("map2_1.hbm.xml")
.addResource("map2_2.hbm.xml");
SessionFactory sessions2 = cfg2.buildSessionFactory();
Session session2 = sessions2.openSession();
But you cannot mix the mapping files. Every POJO and their properties will be connected with one database. You cannot have one property mapped to one database and another property mapped to other database.