Hi All,
I have two DaoManagers in my application. I saw an inconsistent behavior when
getting the local session handler from one of the Dao Managers. I noticed
that one of the Dao Manager gave me the context (session handler) that belonged
to the other Dao Manager. Furthermore, I noticed this when I had called
OpenConnection on the incorrect Dao Manager. After I switched the
OpenConnection on the correct Dao Manager, I got the correct session handler.
Currently I notice that CondfiguerAndWatch will only work on one of the
DaoManager configurations, but not both. The one that it works on, is random.
Some sample code
public void Init()
{ _daoManager1 = ServiceConfig1.GetInstance().DaoManager;
_DaoManager2 = ServiceConfig2.GetInstance().DaoManager;
_subjectDao = (ISubjectDao)_daoManager[typeof(ISubjectDao)];
_subjectIndexDao =
(ISubjectIndexDao)_subjectIndexDaoManager[typeof(ISubjectIndexDao)];
_dataRequestDao =
(IDataRequestDao)_daoManager[typeof(IDataRequestDao)];
}
public SubjectSearchCollection SearchSubject(SubjectSearchInputs ssi,
PaginationInfo pageInfo)
{
SubjectSearchCollection subjectSearch = null;
try
{
//I found the issue here, where I was calling _ daoManager1.OpenConnection();
instead of _ DaoManager2.OpenConnection()
_ DaoManager2.OpenConnection();
subjectSearch = _subjectIndexDao.SearchSubject(ssi, pageInfo);
}
finally
{
if (_subjectIndexDaoManager != null)
_subjectIndexDaoManager.CloseConnection();
}
return subjectSearch;
}
I realize that I can have a single DaoManager with 2 contexts for the 2
different data sources, however, due to system security requirements these two
database connections need to be as physically segregated as possible. That is
why I went with a completely separate Dao Manager.
Please let me know if I am violating any of the base assumptions in ibatis,
such as, you can only have a single dao manager in your app domain. Also, will
run into any distributed transaction management issues in the future?
Thanks for your help in advance,
Rafi