You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Rick <ri...@gmail.com> on 2009/01/12 17:19:30 UTC
Is this simple DAO approach sufficient?
I understanding I'm bind my DAOs to a particular sqlmap config being
loaded, but other than some 'purist' unit testing issues, what's wrong
with this simple approach (I'll have a couple different base DAOs that
will load a different config file because going against a different
DB.)
public abstract class GuiDAO {
public static final SqlMapClient sqlMap =
DaoUtil.loadSqlMapClient("sqlMapConfig-gui.xml");
}
public class UserDAO extends GuiDAO {
private static UserDAO instance = new UserDAO();
private UserDAO(){}
public static UserDAO getInstance() {
return instance;
}
public User getUserByDmzID(String dmzID) throws SQLException {
return (User)sqlMap.queryForObject("User.getUserByDmzID", dmzID );
}
//...
}
Other daos that need a different db will extend a different parent DAO.
What are the big drawback to this?