2014-07-14 17 views
0

我有一個要求,我需要創建多個數據庫到我的應用程序,當用戶登錄根據那裏ID需要從相應的數據庫和登錄中挑選用戶名和密碼。(使用超過一個sessoinfactory) 。只通過創建休眠cfg。如何在Hibernate中使用多個數據庫?

SessionFactory sessionFactory1 = new Configuration().configure("oracleconfig.cfg.xml").buildSessionFactory(); 
    SessionFactory sessionFactory2 = new Configuration().configure("derbyconfig.cfg.xml").buildSessionFactory(); 

在這裏它的羊羣編碼的cfg文件,我可以給動態。

+0

http://www.javabeat.net/configuring-multiple-databases-in-hibernate/ –

回答

相關問題