|
From: Michael Y. <sp...@on...> - 2003-12-22 18:33:27
|
Hi gurus, I have some questions on JdbcTemplate and JdbcDaoSupport classes. In JdbcTemplate's afterPropertiesSet() method, the exception translator was eagerly created, which causes problems for me when I try to dynamically use datasources to connect to different databases. I have a wrapper class for datasources, which doesn't know which database to connect to when the beans are set up first. So this afterPropertiesSet() in JdbcTemplate doesn't work in this case. Maybe we can remove the eager creation of exception translator? I do have a work around, which is create a new class that extends from JdbcTemplate and overwrite the afterPropertiesSet() method. The next question on JdbcDaoSupport doesn't have as nice a workaround as the above one. In JdbcDaoSupport, many methods are final, which prevents me from overwriting them. This is kind of inflexible though. I can understand we may want to have final methods, but we can probably never anticipate all the cases where the classes may be used. So is it possible to remove "final" from some of the methods? My workdaround is duplicate JdbcDaoSupport into my own class, which is not as nice as extending it and overwrite some behavior. Spring is pretty flexible, so we should probably maintain this flexibility. Thanks! /Michael. |