I may be reading this whole thing wrong but why use a context parameter at all? Can you split the DAO classes into Something like PersonMysqlDAO and PersonHsqlDAO? Where they would have same/simular method names and can me called from a service like
updateBothDBs(Integer someID) throws ... { PersonMysqlDAO.update(someID) ; PersonHsqlDAO.update(someID) ; }
Don't know if this makes any sense in your situation
James, Steven wrote:
Hi group,
just looking for some opinions on this problem. I have a system which comprises of a number of application the applications access one of 2 databases (mysql, hsqldb) the 2 databases both have the same structure ie the tables are the same. They are replicated from mysql to hsqldb (the resons for this are due to a complex internal network zone structure). I have 2 sets of sqlmaps xml files (due to the use of some propritry sql) and config files. One set of buisness objects, java sqlmaps and the services that work on the data ie the buisness logic. What i am looking for opinions on is twhen the services are created and they get the daos they need to work with i want a nice way of the dao knowing which database the user ie the bl layer requires. my proposal so far is to pass a context id or string to the dao but i dont think that is so neat as i will need to pass this to the services and this may need to pass through other layers etc. Does anyone have an opinion on how to best approach this?
i have written my on simple dao manager and as such do not use the ibatis dao. was this a mistake?
Steve...
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
-- Plato is my friend, Aristotle is my friend, but my greatest friend is truth. - Isaac Newton