|
Hi,
Try following steps,
1) Create two configuration files a) ReadDB.cfg.xml b) WriteDB.cfg.xml
2) Configure both files
eg:- sessionFactory = configuration.configure( new File( dbNameWithPath+".cfg.xml") )
.buildSessionFactory()3) simply add this sesssion factoy to map used application wide
sessionFactoryMap.put(dbName,sessionFactory);
4) create two sessions in your DAO (business layer)
Session readSession=sessionFactoryUtil.getSession("readDB");
Session writeSession=sessionFactoryUtil.getSession("writeDB");
5) then read and wirte
readSession.findObject(....);
writeSession.save(.....);
Hope this helps
-Praful
|